summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2000-12-26 05:09:27 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2000-12-26 05:09:27 +0000
commitcab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290 (patch)
tree45385bd755d8e3876c54b2b0113636f5ceb7976a /src/mesa/main
parentd1ff1f6798b003a820f5de9fad835ff352f31afe (diff)
Major rework of tnl module
New array_cache module Support 8 texture units in core mesa (now support 8 everywhere) Rework core mesa statechange operations to avoid flushing on many noop statechanges.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/Makefile.X1178
-rw-r--r--src/mesa/main/accum.c26
-rw-r--r--src/mesa/main/api_arrayelt.c284
-rw-r--r--src/mesa/main/api_loopback.c5
-rw-r--r--src/mesa/main/api_noop.c56
-rw-r--r--src/mesa/main/api_noop.h11
-rw-r--r--src/mesa/main/api_validate.c137
-rw-r--r--src/mesa/main/api_validate.h50
-rw-r--r--src/mesa/main/attrib.c23
-rw-r--r--src/mesa/main/blend.c88
-rw-r--r--src/mesa/main/buffers.c36
-rw-r--r--src/mesa/main/clip.c18
-rw-r--r--src/mesa/main/colortab.c23
-rw-r--r--src/mesa/main/config.h24
-rw-r--r--src/mesa/main/context.c29
-rw-r--r--src/mesa/main/convolve.c34
-rw-r--r--src/mesa/main/dd.h132
-rw-r--r--src/mesa/main/debug.c20
-rw-r--r--src/mesa/main/depth.c86
-rw-r--r--src/mesa/main/dispatch.c18
-rw-r--r--src/mesa/main/dlist.c1085
-rw-r--r--src/mesa/main/dlist.h26
-rw-r--r--src/mesa/main/drawpix.c7
-rw-r--r--src/mesa/main/enable.c1289
-rw-r--r--src/mesa/main/eval.c357
-rw-r--r--src/mesa/main/feedback.c106
-rw-r--r--src/mesa/main/fog.c50
-rw-r--r--src/mesa/main/get.c96
-rw-r--r--src/mesa/main/hint.c49
-rw-r--r--src/mesa/main/histogram.c50
-rw-r--r--src/mesa/main/light.c423
-rw-r--r--src/mesa/main/light.h9
-rw-r--r--src/mesa/main/lines.c34
-rw-r--r--src/mesa/main/macros.h20
-rw-r--r--src/mesa/main/matrix.c30
-rw-r--r--src/mesa/main/mtypes.h270
-rw-r--r--src/mesa/main/pixel.c246
-rw-r--r--src/mesa/main/points.c44
-rw-r--r--src/mesa/main/polygon.c77
-rw-r--r--src/mesa/main/rastpos.c12
-rw-r--r--src/mesa/main/state.c72
-rw-r--r--src/mesa/main/stencil.c54
-rw-r--r--src/mesa/main/teximage.c28
-rw-r--r--src/mesa/main/texobj.c33
-rw-r--r--src/mesa/main/texstate.c739
-rw-r--r--src/mesa/main/texutil.c6
-rw-r--r--src/mesa/main/varray.c62
47 files changed, 3896 insertions, 2556 deletions
diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11
index 00debd391d..9ea476376d 100644
--- a/src/mesa/main/Makefile.X11
+++ b/src/mesa/main/Makefile.X11
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.35 2000/11/24 15:21:59 keithw Exp $
+# $Id: Makefile.X11,v 1.36 2000/12/26 05:09:27 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
@@ -21,29 +21,9 @@ LIBDIR = ../lib
CORE_SOURCES = \
- tnl/t_vtxfmt.c \
- tnl/t_bbox.c \
- tnl/t_clip.c \
- tnl/t_context.c \
- tnl/t_cva.c \
- tnl/t_debug.c \
- tnl/t_dlist.c \
- tnl/t_eval.c \
- tnl/t_fog.c \
- tnl/t_light.c \
- tnl/t_pipeline.c \
- tnl/t_shade.c \
- tnl/t_stages.c \
- tnl/t_texture.c \
- tnl/t_trans_elt.c \
- tnl/t_varray.c \
- tnl/t_vb.c \
- tnl/t_vbcull.c \
- tnl/t_vbindirect.c \
- tnl/t_vbrender.c \
- tnl/t_vbxform.c \
api_loopback.c \
api_noop.c \
+ api_validate.c \
accum.c \
alpha.c \
attrib.c \
@@ -106,6 +86,40 @@ CORE_SOURCES = \
X86/common_x86.c \
X86/3dnow.c \
X86/katmai.c \
+ swrast_setup/ss_context.c \
+ swrast_setup/ss_triangle.c \
+ swrast_setup/ss_vb.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 \
+ 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_material.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 \
swrast/s_aaline.c \
swrast/s_aatriangle.c \
swrast/s_accum.c \
@@ -134,32 +148,18 @@ CORE_SOURCES = \
swrast/s_stencil.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 \
- math/m_debug_xform.c \
- math/m_matrix.c \
- math/m_translate.c \
- math/m_vector.c \
- math/m_vertices.c \
- math/m_xform.c
-
+ swrast/s_zoom.c
DRIVER_SOURCES = \
- FX/fxvtxfmt.c \
- FX/fxvtxprims.c \
FX/fxapi.c \
FX/fxdd.c \
FX/fxddspan.c \
FX/fxddtex.c \
- FX/fxfastpath.c \
- FX/fxpipeline.c \
FX/fxsetup.c \
FX/fxtexman.c \
- FX/fxtrifuncs.c \
- FX/fxvsetup.c \
+ FX/fxtris.c \
+ FX/fxvb.c \
FX/fxglidew.c \
X/glxapi.c \
X/fakeglx.c \
diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c
index 3f4c1f7d68..e8f9ca9f92 100644
--- a/src/mesa/main/accum.c
+++ b/src/mesa/main/accum.c
@@ -1,4 +1,4 @@
-/* $Id: accum.c,v 1.32 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: accum.c,v 1.33 2000/12/26 05:09:27 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -44,24 +44,30 @@
void
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
{
+ GLfloat tmp[4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
- ctx->Accum.ClearColor[0] = CLAMP( red, -1.0, 1.0 );
- ctx->Accum.ClearColor[1] = CLAMP( green, -1.0, 1.0 );
- ctx->Accum.ClearColor[2] = CLAMP( blue, -1.0, 1.0 );
- ctx->Accum.ClearColor[3] = CLAMP( alpha, -1.0, 1.0 );
- ctx->NewState |= _NEW_ACCUM;
-}
+ tmp[0] = CLAMP( red, -1.0, 1.0 );
+ tmp[1] = CLAMP( green, -1.0, 1.0 );
+ tmp[2] = CLAMP( blue, -1.0, 1.0 );
+ tmp[3] = CLAMP( alpha, -1.0, 1.0 );
+
+ if (TEST_EQ_4V(tmp, ctx->Accum.ClearColor))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_ACCUM);
+ COPY_4FV( ctx->Accum.ClearColor, tmp );
+}
+/* Should really be a driver-supplied function?
+ */
void
_mesa_Accum( GLenum op, GLfloat value )
{
GET_CURRENT_CONTEXT(ctx);
GLuint xpos, ypos, width, height;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->Visual.AccumRedBits == 0 || ctx->DrawBuffer != ctx->ReadBuffer) {
gl_error(ctx, GL_INVALID_OPERATION, "glAccum");
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
new file mode 100644
index 0000000000..004977c36c
--- /dev/null
+++ b/src/mesa/main/api_arrayelt.c
@@ -0,0 +1,284 @@
+#include "glheader.h"
+#include "api_noop.h"
+#include "context.h"
+#include "colormac.h"
+#include "light.h"
+#include "macros.h"
+#include "mmath.h"
+#include "mtypes.h"
+
+
+typedef struct {
+ GLint unit;
+ struct gl_client_array *array;
+ void *func;
+} AAtexarray;
+
+
+typedef struct {
+ struct gl_client_array *array;
+ void *func;
+} AAarray;
+
+typedef struct {
+ AAtexarray texarrays[MAX_TEXTURE_UNITS+1];
+ AAarray arrays[10];
+ GLuint NewState;
+} AAcontext;
+
+
+static void *colorfuncs[2][7] = {
+ { glColor3bv,
+ glColor3ub,
+ glColor3sv,
+ glColor3usv,
+ glColor3iv,
+ glColor3fv,
+ glColor3dv },
+
+ { glColor4bv,
+ glColor4ub,
+ glColor4sv,
+ glColor4usv,
+ glColor4iv,
+ glColor4fv,
+ glColor4dv }
+};
+
+static void *vertexfuncs[3][7] = {
+ { glVertex3bv,
+ glVertex3ub,
+ glVertex3sv,
+ glVertex3usv,
+ glVertex3iv,
+ glVertex3fv,
+ glVertex3dv },
+
+ { glVertex3bv,
+ glVertex3ub,
+ glVertex3sv,
+ glVertex3usv,
+ glVertex3iv,
+ glVertex3fv,
+ glVertex3dv },
+
+ { glVertex4bv,
+ glVertex4ub,
+ glVertex4sv,
+ glVertex4usv,
+ glVertex4iv,
+ glVertex4fv,
+ glVertex4dv }
+};
+
+
+static void *multitexfuncs[4][7] = {
+ { glMultiTexCoord1bv,
+ glMultiTexCoord1ub,
+ glMultiTexCoord1sv,
+ glMultiTexCoord1usv,
+ glMultiTexCoord1iv,
+ glMultiTexCoord1fv,
+ glMultiTexCoord1dv },
+
+ { glMultiTexCoord2bv,
+ glMultiTexCoord2ub,
+ glMultiTexCoord2sv,
+ glMultiTexCoord2usv,
+ glMultiTexCoord2iv,
+ glMultiTexCoord2fv,
+ glMultiTexCoord2dv },
+
+ { glMultiTexCoord3bv,
+ glMultiTexCoord3ub,
+ glMultiTexCoord3sv,
+ glMultiTexCoord3usv,
+ glMultiTexCoord3iv,
+ glMultiTexCoord3fv,
+ glMultiTexCoord3dv },
+
+ { glMultiTexCoord4bv,
+ glMultiTexCoord4ub,
+ glMultiTexCoord4sv,
+ glMultiTexCoord4usv,
+ glMultiTexCoord4iv,
+ glMultiTexCoord4fv,
+ glMultiTexCoord4dv }
+};
+
+static void *indexfuncs[7] = {
+ { glIndexbv,
+ glIndexub,
+ glIndexsv,
+ glIndexusv,
+ glIndexiv,
+ glIndexfv,
+ glIndexdv },
+};
+
+static void *edgeflagfuncs[7] = {
+ { glEdgeFlagbv,
+ glEdgeFlagub,
+ glEdgeFlagsv,
+ glEdgeFlagusv,
+ glEdgeFlagiv,
+ glEdgeFlagfv,
+ glEdgeFlagdv },
+};
+
+static void *normalfuncs[7] = {
+ { glNormal3bv,
+ glNormal3ub,
+ glNormal3sv,
+ glNormal3usv,
+ glNormal3iv,
+ glNormal3fv,
+ glNormal3dv },
+};
+
+static void *fogcoordfuncs[7] = {
+ { glFogCoordbv,
+ glFogCoordub,
+ glFogCoordsv,
+ glFogCoordusv,
+ glFogCoordiv,
+ glFogCoordfv,
+ glFogCoorddv },
+};
+
+static void *secondarycolorfuncs[7] = {
+ { glSecondaryColor3bv,
+ glSecondaryColor3ub,
+ glSecondaryColor3sv,
+ glSecondaryColor3usv,
+ glSecondaryColor3iv,
+ glSecondaryColor3fv,
+ glSecondaryColor3dv },
+};
+
+
+void _aa_create_context( GLcontext *ctx )
+{
+ ctx->aa_context = MALLOC( sizeof(AAcontext) );
+ AA_CONTEXT(ctx)->NewState = ~0;
+}
+
+static void _aa_update_state( GLcontext *ctx )
+{
+ AAcontext *actx = AA_CONTEXT(ctx);
+ AAtexarray *ta = actx->texarrays;
+ AAarray *aa = actx->arrays;
+ int i;
+
+ for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ if (ctx->Array.TexCoord[i].Enabled) {
+ ta->unit = i;
+ ta->array = &ctx->Array.TexCoord[i];
+ ta->func = multitexfuncs[ta->array->Size-1][TYPE_IDX(ta->array->Type)];
+ ta++;
+ }
+
+ ta->func = 0;
+
+ if (ctx->Array.Color.Enabled) {
+ aa->array = &ctx->Array.Color;
+ aa->func = colorfuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+
+ if (ctx->Array.Normal.Enabled) {
+ aa->array = &ctx->Array.Normal;
+ aa->func = normalfuncs[TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+
+ if (ctx->Array.Index.Enabled) {
+ aa->array = &ctx->Array.Index;
+ aa->func = indexfuncs[TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+
+ if (ctx->Array.EdgeFlag.Enabled) {
+ aa->array = &ctx->Array.Edgeflag;
+ aa->func = edgeflagfuncs[TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+
+ if (ctx->Array.FogCoord.Enabled) {
+ aa->array = &ctx->Array.Fogcoord;
+ aa->func = fogcoordfuncs[TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+
+ if (ctx->Array.SecondaryColor.Enabled) {
+ aa->array = &ctx->Array.SecondaryColor;
+ aa->func = secondarycolorfuncs[TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+
+ /* Must be last
+ */
+ if (ctx->Array.Vertex.Enabled) {
+ aa->array = &ctx->Array.Vertex;
+ aa->func = vertexfuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
+ aa++;
+ }
+
+ aa->func = 0;
+ actx->NewState = 0;
+}
+
+
+static void _aa_loopback_array_elt( GLint elt )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ AAcontext *actx = AA_CONTEXT(ctx);
+ AAtexarray *ta;
+ AAarray *aa;
+
+ for (ta = actx->texarrays ; ta->func ; ta++) {
+ void (*func)( GLint, const void * ) =
+ (void (*)( GLint, const void * )) ta->func;
+ func( ta->unit, (char *)ta->array->Ptr + elt * ta->array->SizeB );
+ }
+
+ for (aa = actx->arrays ; aa->func ; aa++) {
+ void (*func)( GLint, const void * ) =
+ (void (*)( GLint, const void * )) aa->func;
+ func( (char *)aa->array->Ptr + elt * aa->array->SizeB );
+ }
+}
+
+
+void _aa_exec_array_elt( GLint elt )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ AAcontext *actx = AA_CONTEXT(ctx);
+
+ if (actx->NewState)
+ _aa_update_state( ctx );
+
+ ctx->Exec->ArrayElement = _aa_loopback_array_elt;
+ _aa_loopback_array_elt( elt );
+}
+
+/* This works for save as well:
+ */
+void _aa_save_array_elt( GLint elt )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ AAcontext *actx = AA_CONTEXT(ctx);
+
+ if (actx->NewState)
+ _aa_update_state( ctx );
+
+ ctx->Save->ArrayElement = _aa_loopback_array_elt;
+ _aa_loopback_array_elt( elt );
+}
+
+
+void aa_invalidate_state( GLcontext *ctx, GLuint new_state )
+{
+ if (AA_CONTEXT(ctx))
+ AA_CONTEXT(ctx)->NewState |= new_state;
+}
diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index 689b785596..e8b642741f 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -1,4 +1,4 @@
-/* $Id: api_loopback.c,v 1.3 2000/11/27 18:17:09 brianp Exp $ */
+/* $Id: api_loopback.c,v 1.4 2000/12/26 05:09:27 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -548,7 +548,7 @@ loopback_Indexd( GLdouble c )
static void
loopback_Indexf( GLfloat c )
{
- INDEX( (GLint) c );
+ INDEX( (GLuint) (GLint) c );
}
static void
@@ -1362,6 +1362,7 @@ loopback_SecondaryColor3usvEXT_f( const GLushort *v )
}
+
void
_mesa_loopback_prefer_float( struct _glapi_table *dest,
GLboolean prefer_float_colors )
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index 031dde83c6..bd5c3cd3ea 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -1,5 +1,6 @@
#include "glheader.h"
#include "api_noop.h"
+#include "api_validate.h"
#include "context.h"
#include "colormac.h"
#include "light.h"
@@ -468,7 +469,7 @@ void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
{
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx, "_mesa_noop_Rectf");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
}
glBegin( GL_QUADS );
@@ -480,32 +481,22 @@ void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
}
-#if 0
-
/* Some very basic support for arrays. Drivers without explicit array
- * support can hook these in, but it may be more efficient to fall
- * back to swtnl. Particularly if the driver is implementing a
- * software fastpath rather than driving a hardware t&l unit.
- */
-
-/* A codegen implementation of this which hardwires the multiplies and
- * inlines the called functions would fly:
+ * support can hook these in, but still need to supply an array-elt
+ * implementation.
*/
-void _mesa_noop_ArrayElement( GLint elt )
-{
- GET_CURRENT_CONTEXT(ctx);
- int i;
- for (i = 0 ; i < ctx->Array._nr_enabled ; i++) {
- struct gl_client_array *a = ctx->Array._enabled[i];
- a->_EltFunc( a->Data + elt * a->StrideB );
- }
-}
-
void _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
{
+ GET_CURRENT_CONTEXT(ctx);
GLint i;
+
+ if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
+ return;
+
+ glBegin(mode);
for (i = start ; i <= count ; i++)
glArrayElement( i );
+ glEnd();
}
@@ -515,12 +506,10 @@ void _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
GET_CURRENT_CONTEXT(ctx);
GLint i;
- if (count <= 0) {
- if (count < 0) {
- gl_error( ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
- }
+ if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
return;
- }
+
+ glBegin(mode);
switch (type) {
case GL_UNSIGNED_BYTE:
@@ -539,13 +528,20 @@ void _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
gl_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
break;
}
+
+ glEnd();
}
-void _mesa_noop_DrawRangeElements(GLenum mode, GLuint start,
- GLuint end, GLsizei count,
- GLenum type, const GLvoid *indices)
+void _mesa_noop_DrawRangeElements(GLenum mode,
+ GLuint start, GLuint end,
+ GLsizei count, GLenum type,
+ const GLvoid *indices)
{
- glDrawElements( mode, count, type, indices );
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (_mesa_validate_DrawRangeElements( ctx, mode,
+ start, end,
+ count, type, indices ))
+ glDrawElements( mode, count, type, indices );
}
-#endif
diff --git a/src/mesa/main/api_noop.h b/src/mesa/main/api_noop.h
index 9d6e67dbc5..b656ec6d44 100644
--- a/src/mesa/main/api_noop.h
+++ b/src/mesa/main/api_noop.h
@@ -98,4 +98,15 @@ extern void _mesa_noop_TexCoord4fv( GLfloat *v );
*/
extern void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
+
+extern void _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count);
+extern void _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices);
+extern void _mesa_noop_DrawRangeElements(GLenum mode,
+ GLuint start, GLuint end,
+ GLsizei count, GLenum type,
+ const GLvoid *indices);
+
+
+
#endif
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
new file mode 100644
index 0000000000..931d5c6520
--- /dev/null
+++ b/src/mesa/main/api_validate.c
@@ -0,0 +1,137 @@
+
+/* $Id: api_validate.c,v 1.1 2000/12/26 05:09:27 keithw Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2000 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 "glheader.h"
+#include "context.h"
+#include "mtypes.h"
+#include "api_validate.h"
+
+GLboolean
+_mesa_validate_DrawElements(GLcontext *ctx,
+ GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices)
+{
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ if (count <= 0) {
+ if (count < 0)
+ gl_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
+ return GL_FALSE;
+ }
+
+ if (mode < 0 ||
+ mode > GL_POLYGON) {
+ gl_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
+ return GL_FALSE;
+ }
+
+ if (type != GL_UNSIGNED_INT &&
+ type != GL_UNSIGNED_BYTE &&
+ type != GL_UNSIGNED_SHORT)
+ {
+ gl_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
+ return GL_FALSE;
+ }
+
+ if (ctx->NewState)
+ gl_update_state( ctx );
+
+ if (!ctx->Array.Vertex.Enabled)
+ return GL_FALSE;
+
+ return GL_TRUE;
+}
+
+
+GLboolean
+_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
+ GLuint start, GLuint end,
+ GLsizei count, GLenum type,
+ const GLvoid *indices)
+{
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ if (count <= 0) {
+ if (count < 0)
+ gl_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
+ return GL_FALSE;
+ }
+
+ if (mode < 0 || mode > GL_POLYGON) {
+ gl_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
+ return GL_FALSE;
+ }
+
+ if (end < start) {
+ gl_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(end<start)");
+ return GL_FALSE;
+ }
+
+ if (type != GL_UNSIGNED_INT &&
+ type != GL_UNSIGNED_BYTE &&
+ type != GL_UNSIGNED_SHORT)
+ {
+ gl_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
+ return GL_FALSE;
+ }
+
+ if (ctx->NewState)
+ gl_update_state( ctx );
+
+ if (!ctx->Array.Vertex.Enabled)
+ return GL_FALSE;
+
+ return GL_TRUE;
+}
+
+
+
+GLboolean
+_mesa_validate_DrawArrays(GLcontext *ctx,
+ GLenum mode, GLint start, GLsizei count)
+{
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ if (count<0) {
+ gl_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
+ return GL_FALSE;
+ }
+
+ if (mode < 0 || mode > GL_POLYGON) {
+ gl_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
+ return GL_FALSE;
+ }
+
+ if (ctx->NewState)
+ gl_update_state( ctx );
+
+ if (!ctx->Array.Vertex.Enabled)
+ return GL_FALSE;
+
+ return GL_TRUE;
+}
+
diff --git a/src/mesa/main/api_validate.h b/src/mesa/main/api_validate.h
new file mode 100644
index 0000000000..7f381a0429
--- /dev/null
+++ b/src/mesa/main/api_validate.h
@@ -0,0 +1,50 @@
+/* $Id: api_validate.h,v 1.1 2000/12/26 05:09:27 keithw Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2000 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 API_VALIDATE_H
+#define API_VALIDATE_H
+
+
+#include "mtypes.h"
+
+extern GLboolean
+_mesa_validate_DrawArrays(GLcontext *ctx,
+ GLenum mode, GLint start, GLsizei count);
+
+extern GLboolean
+_mesa_validate_DrawElements(GLcontext *ctx,
+ GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices);
+
+extern GLboolean
+_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
+ GLuint start, GLuint end,
+ GLsizei count, GLenum type,
+ const GLvoid *indices);
+
+
+#endif
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 3fab941688..6158a64869 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,4 +1,4 @@
-/* $Id: attrib.c,v 1.38 2000/12/14 20:25:56 brianp Exp $ */
+/* $Id: attrib.c,v 1.39 2000/12/26 05:09:27 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -100,7 +100,7 @@ _mesa_PushAttrib(GLbitfield mask)
struct gl_attrib_node *head;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushAttrib");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glPushAttrib %x\n", (int)mask);
@@ -136,9 +136,7 @@ _mesa_PushAttrib(GLbitfield mask)
if (mask & GL_CURRENT_BIT) {
struct gl_current_attrib *attr;
-
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
-
+ FLUSH_CURRENT( ctx, 0 );
attr = MALLOC_STRUCT( gl_current_attrib );
MEMCPY( attr, &ctx->Current, sizeof(struct gl_current_attrib) );
newnode = new_attrib_node( GL_CURRENT_BIT );
@@ -257,6 +255,7 @@ _mesa_PushAttrib(GLbitfield mask)
if (mask & GL_LIGHTING_BIT) {
struct gl_light_attrib *attr;
+ FLUSH_CURRENT(ctx, 0); /* flush material changes */
attr = MALLOC_STRUCT( gl_light_attrib );
MEMCPY( attr, &ctx->Light, sizeof(struct gl_light_attrib) );
newnode = new_attrib_node( GL_LIGHTING_BIT );
@@ -546,9 +545,7 @@ _mesa_PopAttrib(void)
{
struct gl_attrib_node *attr, *next;
GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopAttrib");
-
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->AttribStackDepth==0) {
gl_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" );
@@ -616,7 +613,7 @@ _mesa_PopAttrib(void)
}
break;
case GL_CURRENT_BIT:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT( ctx, 0 );
MEMCPY( &ctx->Current, attr->data,
sizeof(struct gl_current_attrib) );
break;
@@ -872,7 +869,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
struct gl_attrib_node *head;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushClientAttrib");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->ClientAttribStackDepth>=MAX_CLIENT_ATTRIB_STACK_DEPTH) {
gl_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" );
@@ -923,7 +920,7 @@ _mesa_PopClientAttrib(void)
struct gl_attrib_node *attr, *next;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopClientAttrib");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->ClientAttribStackDepth==0) {
gl_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" );
@@ -938,14 +935,17 @@ _mesa_PopClientAttrib(void)
case GL_CLIENT_PACK_BIT:
MEMCPY( &ctx->Pack, attr->data,
sizeof(struct gl_pixelstore_attrib) );
+ ctx->NewState = _NEW_PACKUNPACK;
break;
case GL_CLIENT_UNPACK_BIT:
MEMCPY( &ctx->Unpack, attr->data,
sizeof(struct gl_pixelstore_attrib) );
+ ctx->NewState = _NEW_PACKUNPACK;
break;
case GL_CLIENT_VERTEX_ARRAY_BIT:
MEMCPY( &ctx->Array, attr->data,
sizeof(struct gl_array_attrib) );
+ ctx->NewState = _NEW_ARRAY;
break;
default:
gl_problem( ctx, "Bad attrib flag in PopClientAttrib");
@@ -958,7 +958,6 @@ _mesa_PopClientAttrib(void)
attr = next;
}
- ctx->NewState = _NEW_ARRAY;
}
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 621969de24..ef1ec85c91 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -1,4 +1,4 @@
-/* $Id: blend.c,v 1.26 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: blend.c,v 1.27 2000/12/26 05:09:27 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -41,8 +41,9 @@
void
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
{
+
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFunc");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "glBlendFunc %s %s\n",
@@ -70,7 +71,6 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
- ctx->Color.BlendSrcRGB = ctx->Color.BlendSrcA = sfactor;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glBlendFunc(sfactor)" );
@@ -97,18 +97,24 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
- ctx->Color.BlendDstRGB = ctx->Color.BlendDstA = dfactor;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glBlendFunc(dfactor)" );
return;
}
- if (ctx->Driver.BlendFunc) {
- (*ctx->Driver.BlendFunc)( ctx, sfactor, dfactor );
- }
+ if (ctx->Color.BlendDstRGB == dfactor &&
+ ctx->Color.BlendSrcRGB == sfactor &&
+ ctx->Color.BlendDstA == dfactor &&
+ ctx->Color.BlendSrcA == sfactor)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.BlendDstRGB = ctx->Color.BlendDstA = dfactor;
+ ctx->Color.BlendSrcRGB = ctx->Color.BlendSrcA = sfactor;
- ctx->NewState |= _NEW_COLOR;
+ if (ctx->Driver.BlendFunc)
+ ctx->Driver.BlendFunc( ctx, sfactor, dfactor );
}
@@ -118,7 +124,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFuncSeparate");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "glBlendFuncSeperate %s %s %s %s\n",
@@ -148,7 +154,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
- ctx->Color.BlendSrcRGB = sfactorRGB;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorRGB)");
@@ -175,7 +180,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
- ctx->Color.BlendDstRGB = dfactorRGB;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorRGB)");
@@ -203,7 +207,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
- ctx->Color.BlendSrcA = sfactorA;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorA)");
@@ -230,14 +233,24 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
- ctx->Color.BlendDstA = dfactorA;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorA)" );
return;
}
- ctx->NewState |= _NEW_COLOR;
+ if (ctx->Color.BlendSrcRGB == sfactorRGB &&
+ ctx->Color.BlendDstRGB == dfactorRGB &&
+ ctx->Color.BlendSrcA == sfactorA &&
+ ctx->Color.BlendDstA == dfactorA)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+
+ ctx->Color.BlendSrcRGB = sfactorRGB;
+ ctx->Color.BlendDstRGB = dfactorRGB;
+ ctx->Color.BlendSrcA = sfactorA;
+ ctx->Color.BlendDstA = dfactorA;
if (ctx->Driver.BlendFuncSeparate) {
(*ctx->Driver.BlendFuncSeparate)( ctx, sfactorRGB, dfactorRGB,
@@ -252,7 +265,7 @@ void
_mesa_BlendEquation( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendEquation");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "glBlendEquation %s\n",
@@ -262,22 +275,15 @@ _mesa_BlendEquation( GLenum mode )
case GL_MIN_EXT:
case GL_MAX_EXT:
case GL_FUNC_ADD_EXT:
- if (ctx->Extensions.EXT_blend_minmax) {
- ctx->Color.BlendEquation = mode;
- }
- else {
+ if (!ctx->Extensions.EXT_blend_minmax) {
gl_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
return;
}
case GL_LOGIC_OP:
- ctx->Color.BlendEquation = mode;
break;
case GL_FUNC_SUBTRACT_EXT:
case GL_FUNC_REVERSE_SUBTRACT_EXT:
- if (ctx->Extensions.EXT_blend_subtract) {
- ctx->Color.BlendEquation = mode;
- }
- else {
+ if (!ctx->Extensions.EXT_blend_subtract) {
gl_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
return;
}
@@ -287,17 +293,17 @@ _mesa_BlendEquation( GLenum mode )
return;
}
+ if (ctx->Color.BlendEquation == mode)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.BlendEquation = mode;
+
/* This is needed to support 1.1's RGB logic ops AND
* 1.0's blending logicops.
*/
- if (mode==GL_LOGIC_OP && ctx->Color.BlendEnabled) {
- ctx->Color.ColorLogicOpEnabled = GL_TRUE;
- }
- else {
- ctx->Color.ColorLogicOpEnabled = GL_FALSE;
- }
-
- ctx->NewState |= _NEW_COLOR;
+ ctx->Color.ColorLogicOpEnabled = (mode==GL_LOGIC_OP &&
+ ctx->Color.BlendEnabled);
if (ctx->Driver.BlendEquation)
ctx->Driver.BlendEquation( ctx, mode );
@@ -308,11 +314,19 @@ _mesa_BlendEquation( GLenum mode )
void
_mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
{
+ GLfloat tmp[4];
GET_CURRENT_CONTEXT(ctx);
- ctx->Color.BlendColor[0] = CLAMP( red, 0.0F, 1.0F );
- ctx->Color.BlendColor[1] = CLAMP( green, 0.0F, 1.0F );
- ctx->Color.BlendColor[2] = CLAMP( blue, 0.0F, 1.0F );
- ctx->Color.BlendColor[3] = CLAMP( alpha, 0.0F, 1.0F );
- ctx->NewState |= _NEW_COLOR;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ tmp[0] = CLAMP( red, 0.0, 1.0 );
+ tmp[1] = CLAMP( green, 0.0, 1.0 );
+ tmp[2] = CLAMP( blue, 0.0, 1.0 );
+ tmp[3] = CLAMP( alpha, 0.0, 1.0 );
+
+ if (TEST_EQ_4V(tmp, ctx->Color.BlendColor))
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ COPY_4FV( ctx->Color.BlendColor, tmp );
}
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index dc802d9e11..da1e6125c9 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -1,4 +1,4 @@
-/* $Id: buffers.c,v 1.20 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: buffers.c,v 1.21 2000/12/26 05:09:27 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -49,9 +49,14 @@ void
_mesa_ClearIndex( GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearIndex");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Color.ClearIndex == (GLuint)c)
+ return;
+
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.ClearIndex = (GLuint) c;
- ctx->NewState |= _NEW_COLOR;
if (!ctx->Visual.RGBAflag) {
/* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
@@ -65,14 +70,20 @@ void
_mesa_ClearColor( GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha )
{
+ GLfloat tmp[4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearColor");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
- ctx->Color.ClearColor[0] = CLAMP( red, 0.0F, 1.0F );
- ctx->Color.ClearColor[1] = CLAMP( green, 0.0F, 1.0F );
- ctx->Color.ClearColor[2] = CLAMP( blue, 0.0F, 1.0F );
- ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F );
- ctx->NewState |= _NEW_COLOR;
+ tmp[0] = CLAMP( red, 0.0, 1.0 );
+ tmp[1] = CLAMP( green, 0.0, 1.0 );
+ tmp[2] = CLAMP( blue, 0.0, 1.0 );
+ tmp[3] = CLAMP( alpha, 0.0, 1.0 );
+
+ if (TEST_EQ_4V(tmp, ctx->Color.ClearColor))
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ COPY_4FV( ctx->Color.ClearColor, tmp );
if (ctx->Visual.RGBAflag) {
GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
@@ -92,7 +103,7 @@ void
_mesa_Clear( GLbitfield mask )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClear");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glClear 0x%x\n", mask);
@@ -149,7 +160,8 @@ void
_mesa_DrawBuffer( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawBuffer");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */
+
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glDrawBuffer %s\n", gl_lookup_enum_by_nr(mode));
@@ -301,7 +313,7 @@ void
_mesa_ReadBuffer( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glReadBuffer");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glReadBuffer %s\n", gl_lookup_enum_by_nr(mode));
diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c
index 131f3b6033..c2c7ec3009 100644
--- a/src/mesa/main/clip.c
+++ b/src/mesa/main/clip.c
@@ -1,4 +1,4 @@
-/* $Id: clip.c,v 1.18 2000/11/27 18:22:13 brianp Exp $ */
+/* $Id: clip.c,v 1.19 2000/12/26 05:09:27 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -56,7 +56,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
GET_CURRENT_CONTEXT(ctx);
GLint p;
GLfloat equation[4];
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClipPlane");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
if (p < 0 || p >= ctx->Const.MaxClipPlanes) {
@@ -80,9 +80,13 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
if (ctx->ModelView.flags & MAT_DIRTY)
_math_matrix_analyse( &ctx->ModelView );
- gl_transform_vector( ctx->Transform.EyeUserPlane[p], equation,
- ctx->ModelView.inv );
+ gl_transform_vector( equation, equation, ctx->ModelView.inv );
+ if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation))
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ COPY_4FV(ctx->Transform.EyeUserPlane[p], equation);
/* Update derived state. This state also depends on the projection
* matrix, and is recalculated on changes to the projection matrix by
@@ -97,8 +101,6 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
ctx->ProjectionMatrix.inv );
}
- ctx->NewState |= _NEW_TRANSFORM;
-
if (ctx->Driver.ClipPlane)
ctx->Driver.ClipPlane( ctx, plane, equation );
}
@@ -109,9 +111,7 @@ _mesa_GetClipPlane( GLenum plane, GLdouble *equation )
{
GET_CURRENT_CONTEXT(ctx);
GLint p;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetClipPlane");
-
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
p = (GLint) (plane - GL_CLIP_PLANE0);
if (p < 0 || p >= ctx->Const.MaxClipPlanes) {
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index 48072c8d7a..f063a69795 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -1,4 +1,4 @@
-/* $Id: colortab.c,v 1.32 2000/12/10 19:23:19 brianp Exp $ */
+/* $Id: colortab.c,v 1.33 2000/12/26 05:09:27 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -213,8 +213,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0;
GLboolean floatTable = GL_FALSE;
GLint comps;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorTable");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
switch (target) {
case GL_TEXTURE_1D:
@@ -460,8 +459,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0;
GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0;
GLint comps;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorSubTable");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (target) {
case GL_TEXTURE_1D:
@@ -630,7 +628,7 @@ _mesa_CopyColorTable(GLenum target, GLenum internalformat,
{
GLchan data[MAX_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorTable");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
/* Select buffer to read from */
(*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
@@ -661,7 +659,7 @@ _mesa_CopyColorSubTable(GLenum target, GLsizei start,
{
GLchan data[MAX_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorSubTable");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
/* Select buffer to read from */
(*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
@@ -693,8 +691,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
struct gl_color_table *table = NULL;
GLchan rgba[MAX_COLOR_TABLE_SIZE][4];
GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTable");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState) {
gl_update_state(ctx);
@@ -865,7 +862,7 @@ void
_mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (target) {
case GL_COLOR_TABLE_SGI:
@@ -960,8 +957,7 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_color_table *table = NULL;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameterfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (target) {
case GL_TEXTURE_1D:
@@ -1091,8 +1087,7 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_color_table *table = NULL;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameteriv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (target) {
case GL_TEXTURE_1D:
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 95365d94d1..1b3c4f0f27 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -1,4 +1,4 @@
-/* $Id: config.h,v 1.24 2000/11/20 18:06:11 brianp Exp $ */
+/* $Id: config.h,v 1.25 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -175,28 +175,6 @@
-/* Vertex buffer size. KW: no restrictions on the divisibility of
- * this number, though things may go better for you if you choose a
- * value of 12n + 3.
- */
-#define VB_START 3
-
-#define VB_MAX (216 + VB_START)
-
-
-
-/*
- * Actual vertex buffer size.
- *
- * Arrays must also accomodate new vertices from clipping, and
- * potential overflow from primitives which don't fit into neatly into
- * VB_MAX vertices. (This only happens when mixed primitives are
- * sharing the vb).
- */
-#define VB_MAX_CLIPPED_VERTS ((2 * (6 + MAX_CLIP_PLANES))+1)
-#define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS)
-
-
/*
* Language/compiler stuff
*/
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 2d5b6569cd..12eb9b791a 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.113 2000/12/16 00:21:28 brianp Exp $ */
+/* $Id: context.c,v 1.114 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -77,7 +77,6 @@ int MESA_VERBOSE = 0
/* | VERBOSE_API */
/* | VERBOSE_DRIVER */
/* | VERBOSE_STATE */
-/* | VERBOSE_CULL */
/* | VERBOSE_DISPLAY_LIST */
;
#endif
@@ -603,7 +602,7 @@ init_light( struct gl_light *l, GLuint n )
ASSIGN_4V( l->EyePosition, 0.0, 0.0, 1.0, 0.0 );
ASSIGN_3V( l->EyeDirection, 0.0, 0.0, -1.0 );
l->SpotExponent = 0.0;
- gl_compute_spot_exp_table( l );
+ gl_invalidate_spot_exp_table( l );
l->SpotCutoff = 180.0;
l->_CosCutoff = 0.0; /* KW: -ve values not admitted */
l->ConstantAttenuation = 1.0;
@@ -993,15 +992,6 @@ init_attrib_groups( GLcontext *ctx )
s->refcount = 0;
insert_at_tail( ctx->_ShineTabList, s );
}
- for (i = 0 ; i < 4 ; i++) {
- ctx->_ShineTable[i] = ctx->_ShineTabList->prev;
- ctx->_ShineTable[i]->refcount++;
- }
-
- gl_compute_shine_table( ctx, 0, ctx->Light.Material[0].Shininess );
- gl_compute_shine_table( ctx, 2, ctx->Light.Material[0].Shininess * .5 );
- gl_compute_shine_table( ctx, 1, ctx->Light.Material[1].Shininess );
- gl_compute_shine_table( ctx, 3, ctx->Light.Material[1].Shininess * .5 );
/* Line group */
@@ -1105,10 +1095,9 @@ init_attrib_groups( GLcontext *ctx )
ctx->Polygon.CullFlag = GL_FALSE;
ctx->Polygon.CullFaceMode = GL_BACK;
ctx->Polygon.FrontFace = GL_CCW;
- ctx->Polygon.FrontBit = 0;
+ ctx->Polygon._FrontBit = 0;
ctx->Polygon.FrontMode = GL_FILL;
ctx->Polygon.BackMode = GL_FILL;
- ctx->Polygon._Unfilled = GL_FALSE;
ctx->Polygon.SmoothFlag = GL_FALSE;
ctx->Polygon.StippleFlag = GL_FALSE;
ctx->Polygon.OffsetFactor = 0.0F;
@@ -1848,7 +1837,7 @@ _mesa_get_current_context( void )
void
_mesa_swapbuffers(GLcontext *ctx)
{
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ FLUSH_VERTICES( ctx, 0 );
}
@@ -1989,7 +1978,7 @@ void
_mesa_Finish( void )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFinish");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->Driver.Finish) {
(*ctx->Driver.Finish)( ctx );
}
@@ -2001,7 +1990,7 @@ void
_mesa_Flush( void )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFlush");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->Driver.Flush) {
(*ctx->Driver.Flush)( ctx );
}
@@ -2009,7 +1998,7 @@ _mesa_Flush( void )
-const char *_mesa_prim_name[GL_POLYGON+2] = {
+const char *_mesa_prim_name[GL_POLYGON+4] = {
"GL_POINTS",
"GL_LINES",
"GL_LINE_LOOP",
@@ -2020,7 +2009,9 @@ const char *_mesa_prim_name[GL_POLYGON+2] = {
"GL_QUADS",
"GL_QUAD_STRIP",
"GL_POLYGON",
- "culled primitive"
+ "outside begin/end",
+ "inside unkown primitive",
+ "unknown state"
};
diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c
index c496e6c8f5..24bdd9c4b0 100644
--- a/src/mesa/main/convolve.c
+++ b/src/mesa/main/convolve.c
@@ -1,4 +1,4 @@
-/* $Id: convolve.c,v 1.16 2000/12/10 19:23:19 brianp Exp $ */
+/* $Id: convolve.c,v 1.17 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -112,7 +112,7 @@ _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, G
{
GLenum baseFormat;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionFilter1D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (target != GL_CONVOLUTION_1D) {
gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(target)");
@@ -186,7 +186,7 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G
GLenum baseFormat;
GLint i, components;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionFilter2D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (target != GL_CONVOLUTION_2D) {
gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(target)");
@@ -268,8 +268,7 @@ _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
{
GET_CURRENT_CONTEXT(ctx);
GLuint c;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameterf");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (target) {
case GL_CONVOLUTION_1D:
@@ -313,8 +312,7 @@ _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
GET_CURRENT_CONTEXT(ctx);
struct gl_convolution_attrib *conv;
GLuint c;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameterfv");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (target) {
case GL_CONVOLUTION_1D:
@@ -369,8 +367,7 @@ _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
{
GET_CURRENT_CONTEXT(ctx);
GLuint c;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameteri");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (target) {
case GL_CONVOLUTION_1D:
@@ -414,8 +411,7 @@ _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
GET_CURRENT_CONTEXT(ctx);
struct gl_convolution_attrib *conv;
GLuint c;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameteriv");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (target) {
case GL_CONVOLUTION_1D:
@@ -474,7 +470,7 @@ _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLi
GLenum baseFormat;
GLchan rgba[MAX_CONVOLUTION_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter1D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (target != GL_CONVOLUTION_1D) {
gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(target)");
@@ -511,7 +507,7 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi
struct gl_pixelstore_attrib packSave;
GLchan rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter2D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (target != GL_CONVOLUTION_2D) {
gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(target)");
@@ -570,7 +566,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *im
const struct gl_convolution_attrib *filter;
GLint row;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionFilter");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->NewState) {
gl_update_state(ctx);
@@ -620,8 +616,7 @@ _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
GET_CURRENT_CONTEXT(ctx);
const struct gl_convolution_attrib *conv;
GLuint c;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionParameterfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (target) {
case GL_CONVOLUTION_1D:
@@ -682,8 +677,7 @@ _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
GET_CURRENT_CONTEXT(ctx);
const struct gl_convolution_attrib *conv;
GLuint c;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionParameteriv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (target) {
case GL_CONVOLUTION_1D:
@@ -753,7 +747,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row,
const GLint colStart = MAX_CONVOLUTION_WIDTH * 4;
const struct gl_convolution_attrib *filter;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetSeparableFilter");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->NewState) {
gl_update_state(ctx);
@@ -811,7 +805,7 @@ _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLs
const GLint colStart = MAX_CONVOLUTION_WIDTH * 4;
GLenum baseFormat;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glSeparableFilter2D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (target != GL_SEPARABLE_2D) {
gl_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(target)");
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 250c63d813..cfac5f2ab2 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1,4 +1,4 @@
-/* $Id: dd.h,v 1.43 2000/11/24 10:25:05 keithw Exp $ */
+/* $Id: dd.h,v 1.44 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,12 +31,7 @@
/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */
-
struct gl_pixelstore_attrib;
-struct vertex_buffer;
-struct gl_pipeline;
-struct gl_pipeline_stage;
-
/*
@@ -139,11 +134,6 @@ typedef void (*triangle_func)( GLcontext *ctx,
typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
GLuint v3, GLuint v4, GLuint pv );
-typedef void (*render_func)( struct vertex_buffer *VB,
- GLuint start,
- GLuint count,
- GLuint parity );
-
/*
* Device Driver function table.
@@ -161,7 +151,7 @@ struct dd_function_table {
* NULL can be returned.
*/
- void (*UpdateState)( GLcontext *ctx );
+ void (*UpdateState)( GLcontext *ctx, GLuint new_state );
/*
* UpdateState() is called whenver Mesa thinks the device driver should
* update its state and/or the other pointers (such as PointsFunc,
@@ -752,49 +742,39 @@ struct dd_function_table {
*/
+ void (*RenderStart)( GLcontext *ctx );
+ void (*RenderFinish)( GLcontext *ctx );
+ /* Wrap around all rendering functions. Suitable for
+ * grabbing/releasing hardware locks.
+ */
- /***
- *** Accelerated point, line, polygon and quad functions:
- ***/
- points_func PointsFunc;
- line_func LineFunc;
- triangle_func TriangleFunc;
- quad_func QuadFunc;
-
/***
- *** Transformation/Rendering functions
+ *** Parameters for _tnl_render_stage
***/
+ points_func PointsFunc; /* must now respect vb->elts */
+ line_func LineFunc;
+ triangle_func TriangleFunc;
+ quad_func QuadFunc;
- void (*RenderStart)( GLcontext *ctx );
- void (*RenderFinish)( GLcontext *ctx );
- /* KW: These replace Begin and End, and have more relaxed semantics.
- * They are called prior-to and after one or more vb flush, and are
- * thus decoupled from the gl_begin/gl_end pairs, which are possibly
- * more frequent. If a begin/end pair covers >1 vertex buffer, these
- * are called at most once for the pair. (a bit broken at present)
- */
-
- void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end );
- /* This function, if not NULL, is called whenever new window coordinates
- * are put in the vertex buffer. The vertices in question are those n
- * such that start <= n < end.
- * The device driver can convert the window coords to its own specialized
- * format. The 3Dfx driver uses this.
+ void (*ResetLineStipple)( GLcontext *ctx );
+
+
+ void (*BuildProjectedVertices)( GLcontext *ctx,
+ GLuint start, GLuint end,
+ GLuint new_inputs);
+ /* This function, if not NULL, is called whenever new vertices are
+ * required for rendering. The vertices in question are those n
+ * such that start <= n < end. The new_inputs parameter indicates
+ * those fields of the vertex which need to be updated, if only a
+ * partial repair of the vertex is required.
*
- * Note: Deprecated in favour of RegisterPipelineStages, below.
+ * This function is called only from _tnl_render_stage in tnl/t_render.c.
*/
- render_func *RenderVBClippedTab;
- render_func *RenderVBCulledTab;
- render_func *RenderVBRawTab;
- /* These function tables allow the device driver to rasterize an
- * entire begin/end group of primitives at once. See the
- * gl_render_vb() function in vbrender.c for more details.
- */
- GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno );
+ GLboolean (*MultipassFunc)( GLcontext *ctx, GLuint passno );
/* Driver may request additional render passes by returning GL_TRUE
* when this function is called. This function will be called
* after the first pass, and passes will be made until the function
@@ -804,51 +784,41 @@ struct dd_function_table {
* This function will be first invoked with passno == 1.
*/
+
/***
- *** NEW in Mesa 3.x
+ *** Support for multiple t&l engines
***/
+#define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
+#define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
+#define PRIM_UNKNOWN GL_POLYGON+3
- void (*RegisterVB)( struct vertex_buffer *VB );
- void (*UnregisterVB)( struct vertex_buffer *VB );
- /* When Mesa creates a new vertex buffer it calls Driver.RegisterVB()
- * so the device driver can allocate its own vertex buffer data and
- * hook it to the VB->driver_data pointer.
- * When Mesa destroys a vertex buffer it calls Driver.UnegisterVB()
- * so the driver can deallocate its own data attached to VB->driver_data.
+ GLuint CurrentExecPrimitive;
+ /* Set by the driver-supplied t&l engine. Set to GL_POLYGON+1 when
+ * outside begin/end.
*/
-
-
- GLboolean (*BuildPrecalcPipeline)( GLcontext *ctx );
- GLboolean (*BuildEltPipeline)( GLcontext *ctx );
- /* Perform the full pipeline build, or return false.
+ GLuint CurrentSavePrimitive;
+ /* Current state of an inprogress compilation.
*/
+
- /***
- *** Support for multiple t&l engines
- ***/
-
-#define FLUSH_INSIDE_BEGIN_END 0x1
-#define FLUSH_STORED_VERTICES 0x2
-#define FLUSH_UPDATE_CURRENT 0x4
-
+#define FLUSH_STORED_VERTICES 0x1
+#define FLUSH_UPDATE_CURRENT 0x2
GLuint NeedFlush;
- /* Set by the driver-supplied t&l engine.
- * Bitflags defined above are set whenever
- * - the engine *might* be inside a begin/end object.
- * - there *might* be buffered vertices to be flushed.
- * - the ctx->Current values *might* not be uptodate.
+ /* Set by the driver-supplied t&l engine whenever vertices are
+ * buffered between begin/end objects or ctx->Current is not uptodate.
*
* The FlushVertices() call below may be used to resolve
- * these conditions.
+ * these conditions.
*/
- GLboolean (*FlushVertices)( GLcontext *ctx, GLuint flags );
- /* If inside begin/end, returns GL_FALSE.
+ void (*FlushVertices)( GLcontext *ctx, GLuint flags );
+ /* If inside begin/end, ASSERT(0).
* Otherwise,
* if (flags & FLUSH_STORED_VERTICES) flushes any buffered vertices,
- * if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current,
+ * if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current
+ * and ctx->Light.Material
* returns GL_TRUE.
*
* Note that the default t&l engine never clears the
@@ -866,6 +836,11 @@ struct dd_function_table {
* in time to make changes to dispatch tables, etc.
*/
+ void (*BeginCallList)( GLcontext *ctx, GLuint list );
+ void (*EndCallList)( GLcontext *ctx );
+ /* Notify the t&l component before and after calling a display list.
+ */
+
void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
GLframebuffer *readBuffer );
/* Let the t&l component know when the context becomes current.
@@ -973,7 +948,7 @@ typedef struct {
void (*EdgeFlag)( GLboolean );
void (*EdgeFlagv)( const GLboolean * );
void (*EvalCoord1f)( GLfloat ); /* NOTE */
- void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */
+ void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */
void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */
void (*EvalPoint1)( GLint ); /* NOTE */
@@ -1053,7 +1028,10 @@ typedef struct {
* provide partial t&l acceleration.
*
* Mesa will provide a set of helper functions to do eval within
- * accelerated vertex formats, eventually...
+ * accelerated vertex formats, eventually...
+ *
+ * Update: There seem to be issues re. maintaining correct values
+ * for 'ctx->Current' in the face of Eval and T&L fallbacks...
*/
GLboolean prefer_float_colors;
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 072d6e526c..83e3a8b86b 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -4,7 +4,7 @@
void gl_print_state( const char *msg, GLuint state )
{
fprintf(stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
msg,
state,
(state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "",
@@ -19,7 +19,6 @@ void gl_print_state( const char *msg, GLuint state )
(state & _NEW_HINT) ? "ctx->Hint, " : "",
(state & _NEW_LIGHT) ? "ctx->Light, " : "",
(state & _NEW_LINE) ? "ctx->Line, " : "",
- (state & _NEW_FEEDBACK_SELECT) ? "ctx->Feedback/Select, " : "",
(state & _NEW_PIXEL) ? "ctx->Pixel, " : "",
(state & _NEW_POINT) ? "ctx->Point, " : "",
(state & _NEW_POLYGON) ? "ctx->Polygon, " : "",
@@ -39,11 +38,9 @@ void gl_print_state( const char *msg, GLuint state )
void gl_print_enable_flags( const char *msg, GLuint flags )
{
fprintf(stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
msg,
flags,
- (flags & ENABLE_TEX0) ? "tex-0, " : "",
- (flags & ENABLE_TEX1) ? "tex-1, " : "",
(flags & ENABLE_LIGHT) ? "light, " : "",
(flags & ENABLE_FOG) ? "fog, " : "",
(flags & ENABLE_USERCLIP) ? "userclip, " : "",
@@ -51,10 +48,18 @@ void gl_print_enable_flags( const char *msg, GLuint flags )
(flags & ENABLE_TEXGEN1) ? "tex-gen-1, " : "",
(flags & ENABLE_TEXGEN2) ? "tex-gen-2, " : "",
(flags & ENABLE_TEXGEN3) ? "tex-gen-3, " : "",
+ (flags & ENABLE_TEXGEN4) ? "tex-gen-4, " : "",
+ (flags & ENABLE_TEXGEN5) ? "tex-gen-5, " : "",
+ (flags & ENABLE_TEXGEN6) ? "tex-gen-6, " : "",
+ (flags & ENABLE_TEXGEN7) ? "tex-gen-7, " : "",
(flags & ENABLE_TEXMAT0) ? "tex-mat-0, " : "",
(flags & ENABLE_TEXMAT1) ? "tex-mat-1, " : "",
(flags & ENABLE_TEXMAT2) ? "tex-mat-2, " : "",
(flags & ENABLE_TEXMAT3) ? "tex-mat-3, " : "",
+ (flags & ENABLE_TEXMAT4) ? "tex-mat-4, " : "",
+ (flags & ENABLE_TEXMAT5) ? "tex-mat-5, " : "",
+ (flags & ENABLE_TEXMAT6) ? "tex-mat-6, " : "",
+ (flags & ENABLE_TEXMAT7) ? "tex-mat-7, " : "",
(flags & ENABLE_NORMALIZE) ? "normalize, " : "",
(flags & ENABLE_RESCALE) ? "rescale, " : "");
}
@@ -62,19 +67,17 @@ void gl_print_enable_flags( const char *msg, GLuint flags )
void gl_print_tri_caps( const char *name, GLuint flags )
{
fprintf(stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
name,
flags,
(flags & DD_FEEDBACK) ? "feedback, " : "",
(flags & DD_SELECT) ? "select, " : "",
(flags & DD_FLATSHADE) ? "flat-shade, " : "",
- (flags & DD_MULTIDRAW) ? "multidraw, " : "",
(flags & DD_SEPERATE_SPECULAR) ? "seperate-specular, " : "",
(flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "",
(flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "",
(flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
(flags & DD_TRI_OFFSET) ? "tri-offset, " : "",
- (flags & DD_TRI_CULL) ? "tri-bf-cull, " : "",
(flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "",
(flags & DD_LINE_SMOOTH) ? "line-smooth, " : "",
(flags & DD_LINE_STIPPLE) ? "line-stipple, " : "",
@@ -82,7 +85,6 @@ void gl_print_tri_caps( const char *name, GLuint flags )
(flags & DD_POINT_SMOOTH) ? "point-smooth, " : "",
(flags & DD_POINT_SIZE) ? "point-size, " : "",
(flags & DD_POINT_ATTEN) ? "point-atten, " : "",
- (flags & DD_LIGHTING_CULL) ? "lighting-cull, " : "",
(flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "",
(flags & DD_STENCIL) ? "stencil, " : ""
);
diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c
index 3660bd51ba..789260b860 100644
--- a/src/mesa/main/depth.c
+++ b/src/mesa/main/depth.c
@@ -1,4 +1,4 @@
-/* $Id: depth.c,v 1.24 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: depth.c,v 1.25 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -49,11 +49,16 @@ void
_mesa_ClearDepth( GLclampd depth )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearDepth");
- ctx->Depth.Clear = (GLfloat) CLAMP( depth, 0.0, 1.0 );
+ GLfloat tmp = (GLfloat) CLAMP( depth, 0.0, 1.0 );
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Depth.Clear == tmp)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.Clear = tmp;
if (ctx->Driver.ClearDepth)
(*ctx->Driver.ClearDepth)( ctx, ctx->Depth.Clear );
- ctx->NewState |= _NEW_DEPTH;
}
@@ -62,41 +67,39 @@ void
_mesa_DepthFunc( GLenum func )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthFunc");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "glDepthFunc %s\n", gl_lookup_enum_by_nr(func));
switch (func) {
- case GL_LESS: /* (default) pass if incoming z < stored z */
- case GL_GEQUAL:
- case GL_LEQUAL:
- case GL_GREATER:
- case GL_NOTEQUAL:
- case GL_EQUAL:
- case GL_ALWAYS:
- if (ctx->Depth.Func != func) {
- ctx->Depth.Func = func;
- ctx->NewState |= _NEW_DEPTH;
- ctx->_TriangleCaps &= ~DD_Z_NEVER;
- if (ctx->Driver.DepthFunc) {
- (*ctx->Driver.DepthFunc)( ctx, func );
- }
- }
- break;
- case GL_NEVER:
- if (ctx->Depth.Func != func) {
- ctx->Depth.Func = func;
- ctx->NewState |= _NEW_DEPTH;
- ctx->_TriangleCaps |= DD_Z_NEVER;
- if (ctx->Driver.DepthFunc) {
- (*ctx->Driver.DepthFunc)( ctx, func );
- }
- }
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glDepth.Func" );
+ case GL_LESS: /* (default) pass if incoming z < stored z */
+ case GL_GEQUAL:
+ case GL_LEQUAL:
+ case GL_GREATER:
+ case GL_NOTEQUAL:
+ case GL_EQUAL:
+ case GL_ALWAYS:
+ case GL_NEVER:
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glDepth.Func" );
+ return;
}
+
+ if (ctx->Depth.Func == func)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.Func = func;
+
+ if (func == GL_NEVER)
+ ctx->_TriangleCaps |= DD_Z_NEVER;
+ else
+ ctx->_TriangleCaps &= ~DD_Z_NEVER;
+
+ if (ctx->Driver.DepthFunc)
+ ctx->Driver.DepthFunc( ctx, func );
}
@@ -105,7 +108,7 @@ void
_mesa_DepthMask( GLboolean flag )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthMask");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "glDepthMask %d\n", flag);
@@ -114,13 +117,14 @@ _mesa_DepthMask( GLboolean flag )
* GL_TRUE indicates depth buffer writing is enabled (default)
* GL_FALSE indicates depth buffer writing is disabled
*/
- if (ctx->Depth.Mask != flag) {
- ctx->Depth.Mask = flag;
- ctx->NewState |= _NEW_DEPTH;
- if (ctx->Driver.DepthMask) {
- (*ctx->Driver.DepthMask)( ctx, flag );
- }
- }
+ if (ctx->Depth.Mask == flag)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.Mask = flag;
+
+ if (ctx->Driver.DepthMask)
+ ctx->Driver.DepthMask( ctx, flag );
}
diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c
index a2198cb15f..a2e411eb23 100644
--- a/src/mesa/main/dispatch.c
+++ b/src/mesa/main/dispatch.c
@@ -1,4 +1,4 @@
-/* $Id: dispatch.c,v 1.16 2000/09/05 20:17:37 brianp Exp $ */
+/* $Id: dispatch.c,v 1.17 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -97,6 +97,8 @@ trace(void)
#else
+#ifdef THREADS
+
#define DISPATCH(FUNC, ARGS, MESSAGE) \
const struct _glapi_table *dispatch; \
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
@@ -107,6 +109,19 @@ trace(void)
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
return (dispatch->FUNC) ARGS
+#else
+
+
+#define DISPATCH(FUNC, ARGS, MESSAGE) \
+__asm__ ("jmp *(%%eax) ;" : : "a" (&(_glapi_Dispatch->FUNC)) )
+
+#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
+ const struct _glapi_table *dispatch; \
+ dispatch = _glapi_Dispatch;\
+ return (dispatch->FUNC) ARGS
+
+#endif
+
#endif
@@ -114,5 +129,6 @@ trace(void)
#define GLAPIENTRY
#endif
+#define DO_GEOMETRY
#include "glapitemp.h"
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 22779cc56a..85bb2f9369 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -1,4 +1,4 @@
-/* $Id: dlist.c,v 1.54 2000/11/24 15:21:59 keithw Exp $ */
+/* $Id: dlist.c,v 1.55 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -42,6 +42,7 @@
#include "convolve.h"
#include "copypix.h"
#include "depth.h"
+#include "dlist.h"
#include "enable.h"
#include "enums.h"
#include "eval.h"
@@ -82,7 +83,7 @@ Functions which aren't compiled but executed immediately:
glIsList
glGenLists
glDeleteLists
- glEndList
+ glEndList --- BUT: call ctx->Driver.EndList at end of list execution?
glFeedbackBuffer
glSelectBuffer
glRenderMode
@@ -725,7 +726,7 @@ static void save_Accum( GLenum op, GLfloat value )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ FLUSH_VERTICES(ctx, 0);
n = ALLOC_INSTRUCTION( ctx, OPCODE_ACCUM, 2 );
if (n) {
n[1].e = op;
@@ -741,7 +742,7 @@ static void save_AlphaFunc( GLenum func, GLclampf ref )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_ALPHA_FUNC, 2 );
if (n) {
n[1].e = func;
@@ -757,7 +758,7 @@ static void save_BindTexture( GLenum target, GLuint texture )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_TEXTURE, 2 );
if (n) {
n[1].e = target;
@@ -777,7 +778,7 @@ static void save_Bitmap( GLsizei width, GLsizei height,
GET_CURRENT_CONTEXT(ctx);
GLvoid *image = _mesa_unpack_bitmap( width, height, pixels, &ctx->Unpack );
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_BITMAP, 7 );
if (n) {
n[1].i = (GLint) width;
@@ -802,7 +803,7 @@ static void save_BlendEquation( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_EQUATION, 1 );
if (n) {
n[1].e = mode;
@@ -817,7 +818,7 @@ static void save_BlendFunc( GLenum sfactor, GLenum dfactor )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_FUNC, 2 );
if (n) {
n[1].e = sfactor;
@@ -834,7 +835,7 @@ static void save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_FUNC_SEPARATE, 4 );
if (n) {
n[1].e = sfactorRGB;
@@ -854,7 +855,7 @@ static void save_BlendColor( GLfloat red, GLfloat green,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_COLOR, 4 );
if (n) {
n[1].f = red;
@@ -872,7 +873,7 @@ static void save_CallList( GLuint list )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST, 1 );
if (n) {
n[1].ui = list;
@@ -887,7 +888,7 @@ static void save_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
for (i=0;i<n;i++) {
GLuint list = translate_id( i, type, lists );
@@ -906,7 +907,7 @@ static void save_Clear( GLbitfield mask )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR, 1 );
if (n) {
n[1].bf = mask;
@@ -922,7 +923,7 @@ static void save_ClearAccum( GLfloat red, GLfloat green,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_ACCUM, 4 );
if (n) {
n[1].f = red;
@@ -941,7 +942,7 @@ static void save_ClearColor( GLclampf red, GLclampf green,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_COLOR, 4 );
if (n) {
n[1].f = red;
@@ -959,7 +960,7 @@ static void save_ClearDepth( GLclampd depth )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_DEPTH, 1 );
if (n) {
n[1].f = (GLfloat) depth;
@@ -974,7 +975,7 @@ static void save_ClearIndex( GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_INDEX, 1 );
if (n) {
n[1].f = c;
@@ -989,7 +990,7 @@ static void save_ClearStencil( GLint s )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_STENCIL, 1 );
if (n) {
n[1].i = s;
@@ -1004,7 +1005,7 @@ static void save_ClipPlane( GLenum plane, const GLdouble *equ )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLIP_PLANE, 5 );
if (n) {
n[1].e = plane;
@@ -1025,7 +1026,7 @@ static void save_ColorMask( GLboolean red, GLboolean green,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_MASK, 4 );
if (n) {
n[1].b = red;
@@ -1043,7 +1044,7 @@ static void save_ColorMaterial( GLenum face, GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_MATERIAL, 2 );
if (n) {
n[1].e = face;
@@ -1071,7 +1072,7 @@ static void save_ColorTable( GLenum target, GLenum internalFormat,
GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, table,
&ctx->Unpack);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE, 6 );
if (n) {
n[1].e = target;
@@ -1099,8 +1100,7 @@ save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
GET_CURRENT_CONTEXT(ctx);
Node *n;
- ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv");
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6 );
if (n) {
@@ -1128,8 +1128,7 @@ save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
GET_CURRENT_CONTEXT(ctx);
Node *n;
- ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv");
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6 );
if (n) {
@@ -1160,7 +1159,7 @@ static void save_ColorSubTable( GLenum target, GLsizei start, GLsizei count,
GLvoid *image = _mesa_unpack_image(count, 1, 1, format, type, table,
&ctx->Unpack);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_SUB_TABLE, 6 );
if (n) {
n[1].e = target;
@@ -1186,7 +1185,7 @@ save_CopyColorSubTable(GLenum target, GLsizei start,
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_COLOR_SUB_TABLE, 6 );
if (n) {
n[1].e = target;
@@ -1208,7 +1207,7 @@ save_CopyColorTable(GLenum target, GLenum internalformat,
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_COLOR_TABLE, 6 );
if (n) {
n[1].e = target;
@@ -1231,7 +1230,7 @@ save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width,
GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, filter,
&ctx->Unpack);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_1D, 6 );
if (n) {
n[1].e = target;
@@ -1260,7 +1259,7 @@ save_ConvolutionFilter2D(GLenum target, GLenum internalFormat,
GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, filter,
&ctx->Unpack);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_2D, 7 );
if (n) {
n[1].e = target;
@@ -1286,7 +1285,7 @@ save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3 );
if (n) {
n[1].e = target;
@@ -1304,7 +1303,7 @@ save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 );
if (n) {
n[1].e = target;
@@ -1332,7 +1331,7 @@ save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3 );
if (n) {
n[1].e = target;
@@ -1350,7 +1349,7 @@ save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 );
if (n) {
n[1].e = target;
@@ -1378,7 +1377,7 @@ static void save_CopyPixels( GLint x, GLint y,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_PIXELS, 5 );
if (n) {
n[1].i = x;
@@ -1400,7 +1399,7 @@ save_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_IMAGE1D, 7 );
if (n) {
n[1].e = target;
@@ -1426,7 +1425,7 @@ save_CopyTexImage2D( GLenum target, GLint level,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_IMAGE2D, 8 );
if (n) {
n[1].e = target;
@@ -1453,7 +1452,7 @@ save_CopyTexSubImage1D( GLenum target, GLint level,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6 );
if (n) {
n[1].e = target;
@@ -1477,7 +1476,7 @@ save_CopyTexSubImage2D( GLenum target, GLint level,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8 );
if (n) {
n[1].e = target;
@@ -1504,7 +1503,7 @@ save_CopyTexSubImage3D( GLenum target, GLint level,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9 );
if (n) {
n[1].e = target;
@@ -1529,7 +1528,7 @@ static void save_CullFace( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CULL_FACE, 1 );
if (n) {
n[1].e = mode;
@@ -1544,7 +1543,7 @@ static void save_DepthFunc( GLenum func )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_FUNC, 1 );
if (n) {
n[1].e = func;
@@ -1559,7 +1558,7 @@ static void save_DepthMask( GLboolean mask )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_MASK, 1 );
if (n) {
n[1].b = mask;
@@ -1574,7 +1573,7 @@ static void save_DepthRange( GLclampd nearval, GLclampd farval )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_RANGE, 2 );
if (n) {
n[1].f = (GLfloat) nearval;
@@ -1590,7 +1589,7 @@ static void save_Disable( GLenum cap )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_DISABLE, 1 );
if (n) {
n[1].e = cap;
@@ -1605,7 +1604,7 @@ static void save_DrawBuffer( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_BUFFER, 1 );
if (n) {
n[1].e = mode;
@@ -1624,7 +1623,7 @@ static void save_DrawPixels( GLsizei width, GLsizei height,
GLvoid *image = _mesa_unpack_image(width, height, 1, format, type,
pixels, &ctx->Unpack);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_PIXELS, 5 );
if (n) {
n[1].i = width;
@@ -1647,7 +1646,7 @@ static void save_Enable( GLenum cap )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_ENABLE, 1 );
if (n) {
n[1].e = cap;
@@ -1663,7 +1662,7 @@ void _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_EVALMESH1, 3 );
if (n) {
n[1].e = mode;
@@ -1680,7 +1679,7 @@ void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_EVALMESH2, 5 );
if (n) {
n[1].e = mode;
@@ -1701,7 +1700,7 @@ static void save_Fogfv( GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_FOG, 5 );
if (n) {
n[1].e = pname;
@@ -1757,7 +1756,7 @@ static void save_FrontFace( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_FRONT_FACE, 1 );
if (n) {
n[1].e = mode;
@@ -1774,7 +1773,7 @@ static void save_Frustum( GLdouble left, GLdouble right,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_FRUSTUM, 6 );
if (n) {
n[1].f = left;
@@ -1794,7 +1793,7 @@ static void save_Hint( GLenum target, GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_HINT, 2 );
if (n) {
n[1].e = target;
@@ -1811,7 +1810,7 @@ static void save_HintPGI( GLenum target, GLint mode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_HINT_PGI, 2 );
if (n) {
n[1].e = target;
@@ -1829,7 +1828,7 @@ save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean si
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_HISTOGRAM, 4 );
if (n) {
n[1].e = target;
@@ -1847,7 +1846,7 @@ static void save_IndexMask( GLuint mask )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_INDEX_MASK, 1 );
if (n) {
n[1].ui = mask;
@@ -1861,7 +1860,7 @@ static void save_IndexMask( GLuint mask )
static void save_InitNames( void )
{
GET_CURRENT_CONTEXT(ctx);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
(void) ALLOC_INSTRUCTION( ctx, OPCODE_INIT_NAMES, 0 );
if (ctx->ExecuteFlag) {
(*ctx->Exec->InitNames)();
@@ -1873,7 +1872,7 @@ static void save_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_LIGHT, 6 );
if (OPCODE_LIGHT) {
GLint i, nParams;
@@ -1977,7 +1976,7 @@ static void save_LightModelfv( GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_LIGHT_MODEL, 5 );
if (n) {
n[1].e = pname;
@@ -2031,7 +2030,7 @@ static void save_LineStipple( GLint factor, GLushort pattern )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_LINE_STIPPLE, 2 );
if (n) {
n[1].i = factor;
@@ -2047,7 +2046,7 @@ static void save_LineWidth( GLfloat width )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_LINE_WIDTH, 1 );
if (n) {
n[1].f = width;
@@ -2062,7 +2061,7 @@ static void save_ListBase( GLuint base )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_LIST_BASE, 1 );
if (n) {
n[1].ui = base;
@@ -2076,7 +2075,7 @@ static void save_ListBase( GLuint base )
static void save_LoadIdentity( void )
{
GET_CURRENT_CONTEXT(ctx);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
(void) ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_IDENTITY, 0 );
if (ctx->ExecuteFlag) {
(*ctx->Exec->LoadIdentity)();
@@ -2088,7 +2087,7 @@ static void save_LoadMatrixf( const GLfloat *m )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_MATRIX, 16 );
if (n) {
GLuint i;
@@ -2117,7 +2116,7 @@ static void save_LoadName( GLuint name )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_NAME, 1 );
if (n) {
n[1].ui = name;
@@ -2132,7 +2131,7 @@ static void save_LogicOp( GLenum opcode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_LOGIC_OP, 1 );
if (n) {
n[1].e = opcode;
@@ -2148,7 +2147,7 @@ static void save_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP1, 6 );
if (n) {
GLfloat *pnts = gl_copy_map_points1d( target, stride, order, points );
@@ -2169,7 +2168,7 @@ static void save_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP1, 6 );
if (n) {
GLfloat *pnts = gl_copy_map_points1f( target, stride, order, points );
@@ -2193,7 +2192,7 @@ static void save_Map2d( GLenum target,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP2, 10 );
if (n) {
GLfloat *pnts = gl_copy_map_points2d( target, ustride, uorder,
@@ -2225,7 +2224,7 @@ static void save_Map2f( GLenum target,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP2, 10 );
if (n) {
GLfloat *pnts = gl_copy_map_points2f( target, ustride, uorder,
@@ -2253,7 +2252,7 @@ static void save_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAPGRID1, 3 );
if (n) {
n[1].i = un;
@@ -2277,7 +2276,7 @@ static void save_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAPGRID2, 6 );
if (n) {
n[1].i = un;
@@ -2305,7 +2304,7 @@ static void save_MatrixMode( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_MATRIX_MODE, 1 );
if (n) {
n[1].e = mode;
@@ -2322,7 +2321,7 @@ save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_MIN_MAX, 3 );
if (n) {
n[1].e = target;
@@ -2339,7 +2338,7 @@ static void save_MultMatrixf( const GLfloat *m )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_MULT_MATRIX, 16 );
if (n) {
GLuint i;
@@ -2381,7 +2380,7 @@ static void save_Ortho( GLdouble left, GLdouble right,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_ORTHO, 6 );
if (n) {
n[1].f = left;
@@ -2401,7 +2400,7 @@ static void save_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_MAP, 3 );
if (n) {
n[1].e = map;
@@ -2455,7 +2454,7 @@ static void save_PixelTransferf( GLenum pname, GLfloat param )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TRANSFER, 2 );
if (n) {
n[1].e = pname;
@@ -2477,7 +2476,7 @@ static void save_PixelZoom( GLfloat xfactor, GLfloat yfactor )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_ZOOM, 2 );
if (n) {
n[1].f = xfactor;
@@ -2493,7 +2492,7 @@ static void save_PointParameterfvEXT( GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_POINT_PARAMETERS, 4 );
if (n) {
n[1].e = pname;
@@ -2517,7 +2516,7 @@ static void save_PointSize( GLfloat size )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_POINT_SIZE, 1 );
if (n) {
n[1].f = size;
@@ -2532,7 +2531,7 @@ static void save_PolygonMode( GLenum face, GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_MODE, 2 );
if (n) {
n[1].e = face;
@@ -2551,7 +2550,7 @@ static void save_PolygonStipple( const GLubyte *pattern )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_STIPPLE, 1 );
if (n) {
void *data;
@@ -2569,7 +2568,7 @@ static void save_PolygonOffset( GLfloat factor, GLfloat units )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_OFFSET, 2 );
if (n) {
n[1].f = factor;
@@ -2591,7 +2590,7 @@ static void save_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
static void save_PopAttrib( void )
{
GET_CURRENT_CONTEXT(ctx);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
(void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_ATTRIB, 0 );
if (ctx->ExecuteFlag) {
(*ctx->Exec->PopAttrib)();
@@ -2602,7 +2601,7 @@ static void save_PopAttrib( void )
static void save_PopMatrix( void )
{
GET_CURRENT_CONTEXT(ctx);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
(void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_MATRIX, 0 );
if (ctx->ExecuteFlag) {
(*ctx->Exec->PopMatrix)();
@@ -2613,7 +2612,7 @@ static void save_PopMatrix( void )
static void save_PopName( void )
{
GET_CURRENT_CONTEXT(ctx);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
(void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_NAME, 0 );
if (ctx->ExecuteFlag) {
(*ctx->Exec->PopName)();
@@ -2626,7 +2625,7 @@ static void save_PrioritizeTextures( GLsizei num, const GLuint *textures,
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
for (i=0;i<num;i++) {
Node *n;
@@ -2646,7 +2645,7 @@ static void save_PushAttrib( GLbitfield mask )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_ATTRIB, 1 );
if (n) {
n[1].bf = mask;
@@ -2660,7 +2659,7 @@ static void save_PushAttrib( GLbitfield mask )
static void save_PushMatrix( void )
{
GET_CURRENT_CONTEXT(ctx);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
(void) ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_MATRIX, 0 );
if (ctx->ExecuteFlag) {
(*ctx->Exec->PushMatrix)();
@@ -2672,7 +2671,7 @@ static void save_PushName( GLuint name )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_NAME, 1 );
if (n) {
n[1].ui = name;
@@ -2687,7 +2686,7 @@ static void save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_RASTER_POS, 4 );
if (n) {
n[1].f = x;
@@ -2820,7 +2819,7 @@ static void save_PassThrough( GLfloat token )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_PASSTHROUGH, 1 );
if (n) {
n[1].f = token;
@@ -2835,7 +2834,7 @@ static void save_ReadBuffer( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_READ_BUFFER, 1 );
if (n) {
n[1].e = mode;
@@ -2851,7 +2850,7 @@ save_ResetHistogram(GLenum target)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_RESET_HISTOGRAM, 1 );
if (n) {
n[1].e = target;
@@ -2867,7 +2866,7 @@ save_ResetMinmax(GLenum target)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_RESET_MIN_MAX, 1 );
if (n) {
n[1].e = target;
@@ -2882,7 +2881,7 @@ static void save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_ROTATE, 4 );
if (n) {
n[1].f = angle;
@@ -2906,7 +2905,7 @@ static void save_Scalef( GLfloat x, GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_SCALE, 3 );
if (n) {
n[1].f = x;
@@ -2929,7 +2928,7 @@ static void save_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_SCISSOR, 4 );
if (n) {
n[1].i = x;
@@ -2947,7 +2946,7 @@ static void save_ShadeModel( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_SHADE_MODEL, 1 );
if (n) {
n[1].e = mode;
@@ -2962,7 +2961,7 @@ static void save_StencilFunc( GLenum func, GLint ref, GLuint mask )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_FUNC, 3 );
if (n) {
n[1].e = func;
@@ -2979,7 +2978,7 @@ static void save_StencilMask( GLuint mask )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_MASK, 1 );
if (n) {
n[1].ui = mask;
@@ -2994,7 +2993,7 @@ static void save_StencilOp( GLenum fail, GLenum zfail, GLenum zpass )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_OP, 3 );
if (n) {
n[1].e = fail;
@@ -3011,7 +3010,7 @@ static void save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXENV, 6 );
if (n) {
n[1].e = target;
@@ -3057,7 +3056,7 @@ static void save_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXGEN, 6 );
if (n) {
n[1].e = coord;
@@ -3119,7 +3118,7 @@ static void save_TexParameterfv( GLenum target,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXPARAMETER, 6 );
if (n) {
n[1].e = target;
@@ -3175,7 +3174,7 @@ static void save_TexImage1D( GLenum target,
GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type,
pixels, &ctx->Unpack);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE1D, 8 );
if (n) {
n[1].e = target;
@@ -3214,7 +3213,7 @@ static void save_TexImage2D( GLenum target,
GLvoid *image = _mesa_unpack_image(width, height, 1, format, type,
pixels, &ctx->Unpack);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE2D, 9 );
if (n) {
n[1].e = target;
@@ -3255,7 +3254,7 @@ static void save_TexImage3D( GLenum target,
Node *n;
GLvoid *image = _mesa_unpack_image(width, height, depth, format, type,
pixels, &ctx->Unpack);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE3D, 10 );
if (n) {
n[1].e = target;
@@ -3288,7 +3287,7 @@ static void save_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
Node *n;
GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type,
pixels, &ctx->Unpack);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE1D, 7 );
if (n) {
n[1].e = target;
@@ -3319,7 +3318,7 @@ static void save_TexSubImage2D( GLenum target, GLint level,
Node *n;
GLvoid *image = _mesa_unpack_image(width, height, 1, format, type,
pixels, &ctx->Unpack);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE2D, 9 );
if (n) {
n[1].e = target;
@@ -3352,7 +3351,7 @@ static void save_TexSubImage3D( GLenum target, GLint level,
Node *n;
GLvoid *image = _mesa_unpack_image(width, height, depth, format, type,
pixels, &ctx->Unpack);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE3D, 11 );
if (n) {
n[1].e = target;
@@ -3382,7 +3381,7 @@ static void save_Translatef( GLfloat x, GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TRANSLATE, 3 );
if (n) {
n[1].f = x;
@@ -3406,7 +3405,7 @@ static void save_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_VIEWPORT, 4 );
if (n) {
n[1].i = x;
@@ -3424,7 +3423,7 @@ static void save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_WINDOW_POS, 4 );
if (n) {
n[1].f = x;
@@ -3559,7 +3558,7 @@ static void save_ActiveTextureARB( GLenum target )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_TEXTURE, 1 );
if (n) {
n[1].e = target;
@@ -3575,7 +3574,7 @@ static void save_ClientActiveTextureARB( GLenum target )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLIENT_ACTIVE_TEXTURE, 1 );
if (n) {
n[1].e = target;
@@ -3625,7 +3624,7 @@ static void save_PixelTexGenSGIX(GLenum mode)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_SGIX, 1 );
if (n) {
n[1].e = mode;
@@ -3652,7 +3651,7 @@ save_CompressedTexImage1DARB(GLenum target, GLint level,
else {
Node *n;
GLvoid *image;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = MALLOC(imageSize);
if (!image) {
@@ -3696,7 +3695,7 @@ save_CompressedTexImage2DARB(GLenum target, GLint level,
else {
Node *n;
GLvoid *image;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = MALLOC(imageSize);
if (!image) {
@@ -3741,7 +3740,7 @@ save_CompressedTexImage3DARB(GLenum target, GLint level,
else {
Node *n;
GLvoid *image;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = MALLOC(imageSize);
if (!image) {
@@ -3781,7 +3780,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
GLvoid *image;
GET_CURRENT_CONTEXT(ctx);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = MALLOC(imageSize);
@@ -3820,7 +3819,7 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
GLvoid *image;
GET_CURRENT_CONTEXT(ctx);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = MALLOC(imageSize);
@@ -3861,7 +3860,7 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
GLvoid *image;
GET_CURRENT_CONTEXT(ctx);
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = MALLOC(imageSize);
@@ -3900,7 +3899,7 @@ static void save_PixelTexGenParameteriSGIS(GLenum target, GLint value)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, 2 );
if (n) {
n[1].e = target;
@@ -3979,6 +3978,9 @@ static void execute_list( GLcontext *ctx, GLuint list )
if (!islist(ctx,list))
return;
+ if (ctx->Driver.BeginCallList)
+ ctx->Driver.BeginCallList( ctx, list );
+
/* mesa_print_display_list( list ); */
ctx->CallDepth++;
@@ -4630,6 +4632,9 @@ static void execute_list( GLcontext *ctx, GLuint list )
}
}
ctx->CallDepth--;
+
+ if (ctx->Driver.EndCallList)
+ ctx->Driver.EndCallList( ctx );
}
@@ -4650,6 +4655,8 @@ GLboolean
_mesa_IsList( GLuint list )
{
GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0); /* must be called before assert */
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
return islist(ctx, list);
}
@@ -4662,8 +4669,9 @@ _mesa_DeleteLists( GLuint list, GLsizei range )
{
GET_CURRENT_CONTEXT(ctx);
GLuint i;
+ FLUSH_VERTICES(ctx, 0); /* must be called before assert */
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteLists");
if (range<0) {
gl_error( ctx, GL_INVALID_VALUE, "glDeleteLists" );
return;
@@ -4684,8 +4692,9 @@ _mesa_GenLists(GLsizei range )
{
GET_CURRENT_CONTEXT(ctx);
GLuint base;
+ FLUSH_VERTICES(ctx, 0); /* must be called before assert */
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGenLists", 0);
if (range<0) {
gl_error( ctx, GL_INVALID_VALUE, "glGenLists" );
return 0;
@@ -4722,8 +4731,8 @@ void
_mesa_NewList( GLuint list, GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glNewList");
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0); /* must be called before assert */
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glNewList %u %s\n", list, gl_lookup_enum_by_nr(mode));
@@ -4769,12 +4778,12 @@ void
_mesa_EndList( void )
{
GET_CURRENT_CONTEXT(ctx);
+ FLUSH_CURRENT(ctx, 0); /* must be called before assert */
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glEndList\n");
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glEndList" );
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
-
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); /* ??? */
/* Check that a list is under construction */
if (!ctx->CurrentListPtr) {
@@ -4800,10 +4809,6 @@ _mesa_EndList( void )
ctx->Driver.EndList( ctx );
- /* Haven't tracked down why this is needed.
- */
- ctx->NewState = ~0;
-
ctx->CurrentDispatch = ctx->Exec;
_glapi_set_dispatch( ctx->CurrentDispatch );
}
@@ -4824,9 +4829,10 @@ _mesa_CallList( GLuint list )
}
save_compile_flag = ctx->CompileFlag;
- ctx->CompileFlag = GL_FALSE;
+ if (save_compile_flag) {
+ ctx->CompileFlag = GL_FALSE;
+ }
- FLUSH_TNL( ctx, (FLUSH_STORED_VERTICES | FLUSH_UPDATE_CURRENT) );
execute_list( ctx, list );
ctx->CompileFlag = save_compile_flag;
@@ -4856,8 +4862,6 @@ _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
save_compile_flag = ctx->CompileFlag;
ctx->CompileFlag = GL_FALSE;
- FLUSH_TNL( ctx, (FLUSH_STORED_VERTICES | FLUSH_UPDATE_CURRENT) );
-
for (i=0;i<n;i++) {
list = translate_id( i, type, lists );
execute_list( ctx, ctx->List.ListBase + list );
@@ -4881,11 +4885,634 @@ void
_mesa_ListBase( GLuint base )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glListBase");
+ FLUSH_VERTICES(ctx, 0); /* must be called before assert */
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
ctx->List.ListBase = base;
}
+/* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
+ */
+static void exec_Finish( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->Finish();
+}
+
+static void exec_Flush( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->Flush( );
+}
+
+static void exec_GetBooleanv( GLenum pname, GLboolean *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetBooleanv( pname, params );
+}
+
+static void exec_GetClipPlane( GLenum plane, GLdouble *equation )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetClipPlane( plane, equation );
+}
+
+static void exec_GetDoublev( GLenum pname, GLdouble *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetDoublev( pname, params );
+}
+
+static GLenum exec_GetError( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->GetError( );
+}
+
+static void exec_GetFloatv( GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetFloatv( pname, params );
+}
+
+static void exec_GetIntegerv( GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetIntegerv( pname, params );
+}
+
+static void exec_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetLightfv( light, pname, params );
+}
+
+static void exec_GetLightiv( GLenum light, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetLightiv( light, pname, params );
+}
+
+static void exec_GetMapdv( GLenum target, GLenum query, GLdouble *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMapdv( target, query, v );
+}
+
+static void exec_GetMapfv( GLenum target, GLenum query, GLfloat *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMapfv( target, query, v );
+}
+
+static void exec_GetMapiv( GLenum target, GLenum query, GLint *v )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMapiv( target, query, v );
+}
+
+static void exec_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMaterialfv( face, pname, params );
+}
+
+static void exec_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMaterialiv( face, pname, params );
+}
+
+static void exec_GetPixelMapfv( GLenum map, GLfloat *values )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPixelMapfv( map, values );
+}
+
+static void exec_GetPixelMapuiv( GLenum map, GLuint *values )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPixelMapuiv( map, values );
+}
+
+static void exec_GetPixelMapusv( GLenum map, GLushort *values )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPixelMapusv( map, values );
+}
+
+static void exec_GetPolygonStipple( GLubyte *dest )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPolygonStipple( dest );
+}
+
+static const GLubyte *exec_GetString( GLenum name )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->GetString( name );
+}
+
+static void exec_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexEnvfv( target, pname, params );
+}
+
+static void exec_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexEnviv( target, pname, params );
+}
+
+static void exec_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexGendv( coord, pname, params );
+}
+
+static void exec_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexGenfv( coord, pname, params );
+}
+
+static void exec_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexGeniv( coord, pname, params );
+}
+
+static void exec_GetTexImage( GLenum target, GLint level, GLenum format,
+ GLenum type, GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexImage( target, level, format, type, pixels );
+}
+
+static void exec_GetTexLevelParameterfv( GLenum target, GLint level,
+ GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexLevelParameterfv( target, level, pname, params );
+}
+
+static void exec_GetTexLevelParameteriv( GLenum target, GLint level,
+ GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexLevelParameteriv( target, level, pname, params );
+}
+
+static void exec_GetTexParameterfv( GLenum target, GLenum pname,
+ GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexParameterfv( target, pname, params );
+}
+
+static void exec_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetTexParameteriv( target, pname, params );
+}
+
+static GLboolean exec_IsEnabled( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->IsEnabled( cap );
+}
+
+static void exec_PixelStoref( GLenum pname, GLfloat param )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->PixelStoref( pname, param );
+}
+
+static void exec_PixelStorei( GLenum pname, GLint param )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->PixelStorei( pname, param );
+}
+
+static void exec_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->ReadPixels( x, y, width, height, format, type, pixels );
+}
+
+static GLint exec_RenderMode( GLenum mode )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->RenderMode( mode );
+}
+
+static void exec_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->FeedbackBuffer( size, type, buffer );
+}
+
+static void exec_SelectBuffer( GLsizei size, GLuint *buffer )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->SelectBuffer( size, buffer );
+}
+
+static GLboolean exec_AreTexturesResident(GLsizei n, const GLuint *texName,
+ GLboolean *residences)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->AreTexturesResident( n, texName, residences);
+}
+
+static void exec_ColorPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->ColorPointer( size, type, stride, ptr);
+}
+
+static void exec_DeleteTextures( GLsizei n, const GLuint *texName)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->DeleteTextures( n, texName);
+}
+
+static void exec_DisableClientState( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->DisableClientState( cap );
+}
+
+static void exec_EdgeFlagPointer(GLsizei stride, const void *vptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->EdgeFlagPointer( stride, vptr);
+}
+
+static void exec_EnableClientState( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->EnableClientState( cap );
+}
+
+static void exec_GenTextures( GLsizei n, GLuint *texName )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GenTextures( n, texName );
+}
+
+static void exec_GetPointerv( GLenum pname, GLvoid **params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPointerv( pname, params );
+}
+
+static void exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->IndexPointer( type, stride, ptr);
+}
+
+static void exec_InterleavedArrays(GLenum format, GLsizei stride,
+ const GLvoid *pointer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->InterleavedArrays( format, stride, pointer);
+}
+
+static GLboolean exec_IsTexture( GLuint texture )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ return ctx->Exec->IsTexture( texture );
+}
+
+static void exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->NormalPointer( type, stride, ptr );
+}
+
+static void exec_PopClientAttrib(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->PopClientAttrib();
+}
+
+static void exec_PushClientAttrib(GLbitfield mask)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->PushClientAttrib( mask);
+}
+
+static void exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->TexCoordPointer( size, type, stride, ptr);
+}
+
+static void exec_GetCompressedTexImageARB(GLenum target, GLint level,
+ GLvoid *img)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetCompressedTexImageARB( target, level, img);
+}
+
+static void exec_VertexPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->VertexPointer( size, type, stride, ptr);
+}
+
+static void exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat,
+ GLint x, GLint y, GLsizei width)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->CopyConvolutionFilter1D( target, internalFormat, x, y, width);
+}
+
+static void exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat,
+ GLint x, GLint y, GLsizei width,
+ GLsizei height)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->CopyConvolutionFilter2D( target, internalFormat, x, y, width,
+ height);
+}
+
+static void exec_GetColorTable( GLenum target, GLenum format,
+ GLenum type, GLvoid *data )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetColorTable( target, format, type, data );
+}
+
+static void exec_GetColorTableParameterfv( GLenum target, GLenum pname,
+ GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetColorTableParameterfv( target, pname, params );
+}
+
+static void exec_GetColorTableParameteriv( GLenum target, GLenum pname,
+ GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetColorTableParameteriv( target, pname, params );
+}
+
+static void exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
+ GLvoid *image)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetConvolutionFilter( target, format, type, image);
+}
+
+static void exec_GetConvolutionParameterfv(GLenum target, GLenum pname,
+ GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetConvolutionParameterfv( target, pname, params);
+}
+
+static void exec_GetConvolutionParameteriv(GLenum target, GLenum pname,
+ GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetConvolutionParameteriv( target, pname, params);
+}
+
+static void exec_GetHistogram(GLenum target, GLboolean reset, GLenum format,
+ GLenum type, GLvoid *values)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetHistogram( target, reset, format, type, values);
+}
+
+static void exec_GetHistogramParameterfv(GLenum target, GLenum pname,
+ GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetHistogramParameterfv( target, pname, params);
+}
+
+static void exec_GetHistogramParameteriv(GLenum target, GLenum pname,
+ GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetHistogramParameteriv( target, pname, params);
+}
+
+static void exec_GetMinmax(GLenum target, GLboolean reset, GLenum format,
+ GLenum type, GLvoid *values)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMinmax( target, reset, format, type, values);
+}
+
+static void exec_GetMinmaxParameterfv(GLenum target, GLenum pname,
+ GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMinmaxParameterfv( target, pname, params);
+}
+
+static void exec_GetMinmaxParameteriv(GLenum target, GLenum pname,
+ GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetMinmaxParameteriv( target, pname, params);
+}
+
+static void exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
+ GLvoid *row, GLvoid *column, GLvoid *span)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetSeparableFilter( target, format, type, row, column, span);
+}
+
+static void exec_SeparableFilter2D(GLenum target, GLenum internalFormat,
+ GLsizei width, GLsizei height, GLenum format,
+ GLenum type, const GLvoid *row,
+ const GLvoid *column)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->SeparableFilter2D( target, internalFormat, width, height, format,
+ type, row, column);
+}
+
+static void exec_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPixelTexGenParameterivSGIS( target, value);
+}
+
+static void exec_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->GetPixelTexGenParameterfvSGIS( target, value);
+}
+
+static void exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->ColorPointerEXT( size, type, stride, count, ptr);
+}
+
+static void exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count,
+ const GLboolean *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->EdgeFlagPointerEXT( stride, count, ptr);
+}
+
+static void exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->IndexPointerEXT( type, stride, count, ptr);
+}
+
+static void exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->NormalPointerEXT( type, stride, count, ptr);
+}
+
+static void exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->TexCoordPointerEXT( size, type, stride, count, ptr);
+}
+
+static void exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->VertexPointerEXT( size, type, stride, count, ptr);
+}
+
+static void exec_LockArraysEXT(GLint first, GLsizei count)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->LockArraysEXT( first, count);
+}
+
+static void exec_UnlockArraysEXT( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->UnlockArraysEXT( );
+}
+
+static void exec_ResizeBuffersMESA( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->ResizeBuffersMESA( );
+}
+
+static void exec_SecondaryColorPointerEXT(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->SecondaryColorPointerEXT( size, type, stride, ptr);
+}
+
+static void exec_FogCoordPointerEXT(GLenum type, GLsizei stride,
+ const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Exec->FogCoordPointerEXT( type, stride, ptr);
+}
/*
@@ -4932,8 +5559,8 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->EndList = _mesa_EndList;
table->EvalMesh1 = _mesa_save_EvalMesh1;
table->EvalMesh2 = _mesa_save_EvalMesh2;
- table->Finish = _mesa_Finish;
- table->Flush = _mesa_Flush;
+ table->Finish = exec_Finish;
+ table->Flush = exec_Flush;
table->Fogf = save_Fogf;
table->Fogfv = save_Fogfv;
table->Fogi = save_Fogi;
@@ -4941,38 +5568,38 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->FrontFace = save_FrontFace;
table->Frustum = save_Frustum;
table->GenLists = _mesa_GenLists;
- table->GetBooleanv = _mesa_GetBooleanv;
- table->GetClipPlane = _mesa_GetClipPlane;
- table->GetDoublev = _mesa_GetDoublev;
- table->GetError = _mesa_GetError;
- table->GetFloatv = _mesa_GetFloatv;
- table->GetIntegerv = _mesa_GetIntegerv;
- table->GetLightfv = _mesa_GetLightfv;
- table->GetLightiv = _mesa_GetLightiv;
- table->GetMapdv = _mesa_GetMapdv;
- table->GetMapfv = _mesa_GetMapfv;
- table->GetMapiv = _mesa_GetMapiv;
- table->GetMaterialfv = _mesa_GetMaterialfv;
- table->GetMaterialiv = _mesa_GetMaterialiv;
- table->GetPixelMapfv = _mesa_GetPixelMapfv;
- table->GetPixelMapuiv = _mesa_GetPixelMapuiv;
- table->GetPixelMapusv = _mesa_GetPixelMapusv;
- table->GetPolygonStipple = _mesa_GetPolygonStipple;
- table->GetString = _mesa_GetString;
- table->GetTexEnvfv = _mesa_GetTexEnvfv;
- table->GetTexEnviv = _mesa_GetTexEnviv;
- table->GetTexGendv = _mesa_GetTexGendv;
- table->GetTexGenfv = _mesa_GetTexGenfv;
- table->GetTexGeniv = _mesa_GetTexGeniv;
- table->GetTexImage = _mesa_GetTexImage;
- table->GetTexLevelParameterfv = _mesa_GetTexLevelParameterfv;
- table->GetTexLevelParameteriv = _mesa_GetTexLevelParameteriv;
- table->GetTexParameterfv = _mesa_GetTexParameterfv;
- table->GetTexParameteriv = _mesa_GetTexParameteriv;
+ table->GetBooleanv = exec_GetBooleanv;
+ table->GetClipPlane = exec_GetClipPlane;
+ table->GetDoublev = exec_GetDoublev;
+ table->GetError = exec_GetError;
+ table->GetFloatv = exec_GetFloatv;
+ table->GetIntegerv = exec_GetIntegerv;
+ table->GetLightfv = exec_GetLightfv;
+ table->GetLightiv = exec_GetLightiv;
+ table->GetMapdv = exec_GetMapdv;
+ table->GetMapfv = exec_GetMapfv;
+ table->GetMapiv = exec_GetMapiv;
+ table->GetMaterialfv = exec_GetMaterialfv;
+ table->GetMaterialiv = exec_GetMaterialiv;
+ table->GetPixelMapfv = exec_GetPixelMapfv;
+ table->GetPixelMapuiv = exec_GetPixelMapuiv;
+ table->GetPixelMapusv = exec_GetPixelMapusv;
+ table->GetPolygonStipple = exec_GetPolygonStipple;
+ table->GetString = exec_GetString;
+ table->GetTexEnvfv = exec_GetTexEnvfv;
+ table->GetTexEnviv = exec_GetTexEnviv;
+ table->GetTexGendv = exec_GetTexGendv;
+ table->GetTexGenfv = exec_GetTexGenfv;
+ table->GetTexGeniv = exec_GetTexGeniv;
+ table->GetTexImage = exec_GetTexImage;
+ table->GetTexLevelParameterfv = exec_GetTexLevelParameterfv;
+ table->GetTexLevelParameteriv = exec_GetTexLevelParameteriv;
+ table->GetTexParameterfv = exec_GetTexParameterfv;
+ table->GetTexParameteriv = exec_GetTexParameteriv;
table->Hint = save_Hint;
table->IndexMask = save_IndexMask;
table->InitNames = save_InitNames;
- table->IsEnabled = _mesa_IsEnabled;
+ table->IsEnabled = exec_IsEnabled;
table->IsList = _mesa_IsList;
table->LightModelf = save_LightModelf;
table->LightModelfv = save_LightModelfv;
@@ -5007,8 +5634,8 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->PixelMapfv = save_PixelMapfv;
table->PixelMapuiv = save_PixelMapuiv;
table->PixelMapusv = save_PixelMapusv;
- table->PixelStoref = _mesa_PixelStoref;
- table->PixelStorei = _mesa_PixelStorei;
+ table->PixelStoref = exec_PixelStoref;
+ table->PixelStorei = exec_PixelStorei;
table->PixelTransferf = save_PixelTransferf;
table->PixelTransferi = save_PixelTransferi;
table->PixelZoom = save_PixelZoom;
@@ -5047,15 +5674,15 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->RasterPos4s = save_RasterPos4s;
table->RasterPos4sv = save_RasterPos4sv;
table->ReadBuffer = save_ReadBuffer;
- table->ReadPixels = _mesa_ReadPixels;
- table->RenderMode = _mesa_RenderMode;
+ table->ReadPixels = exec_ReadPixels;
+ table->RenderMode = exec_RenderMode;
table->Rotated = save_Rotated;
table->Rotatef = save_Rotatef;
table->Scaled = save_Scaled;
table->Scalef = save_Scalef;
table->Scissor = save_Scissor;
- table->FeedbackBuffer = _mesa_FeedbackBuffer;
- table->SelectBuffer = _mesa_SelectBuffer;
+ table->FeedbackBuffer = exec_FeedbackBuffer;
+ table->SelectBuffer = exec_SelectBuffer;
table->ShadeModel = save_ShadeModel;
table->StencilFunc = save_StencilFunc;
table->StencilMask = save_StencilMask;
@@ -5081,30 +5708,30 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->Viewport = save_Viewport;
/* GL 1.1 */
- table->AreTexturesResident = _mesa_AreTexturesResident;
+ table->AreTexturesResident = exec_AreTexturesResident;
table->BindTexture = save_BindTexture;
- table->ColorPointer = _mesa_ColorPointer;
+ table->ColorPointer = exec_ColorPointer;
table->CopyTexImage1D = save_CopyTexImage1D;
table->CopyTexImage2D = save_CopyTexImage2D;
table->CopyTexSubImage1D = save_CopyTexSubImage1D;
table->CopyTexSubImage2D = save_CopyTexSubImage2D;
- table->DeleteTextures = _mesa_DeleteTextures;
- table->DisableClientState = _mesa_DisableClientState;
- table->EdgeFlagPointer = _mesa_EdgeFlagPointer;
- table->EnableClientState = _mesa_EnableClientState;
- table->GenTextures = _mesa_GenTextures;
- table->GetPointerv = _mesa_GetPointerv;
- table->IndexPointer = _mesa_IndexPointer;
- table->InterleavedArrays = _mesa_InterleavedArrays;
- table->IsTexture = _mesa_IsTexture;
- table->NormalPointer = _mesa_NormalPointer;
- table->PopClientAttrib = _mesa_PopClientAttrib;
+ table->DeleteTextures = exec_DeleteTextures;
+ table->DisableClientState = exec_DisableClientState;
+ table->EdgeFlagPointer = exec_EdgeFlagPointer;
+ table->EnableClientState = exec_EnableClientState;
+ table->GenTextures = exec_GenTextures;
+ table->GetPointerv = exec_GetPointerv;
+ table->IndexPointer = exec_IndexPointer;
+ table->InterleavedArrays = exec_InterleavedArrays;
+ table->IsTexture = exec_IsTexture;
+ table->NormalPointer = exec_NormalPointer;
+ table->PopClientAttrib = exec_PopClientAttrib;
table->PrioritizeTextures = save_PrioritizeTextures;
- table->PushClientAttrib = _mesa_PushClientAttrib;
- table->TexCoordPointer = _mesa_TexCoordPointer;
+ table->PushClientAttrib = exec_PushClientAttrib;
+ table->TexCoordPointer = exec_TexCoordPointer;
table->TexSubImage1D = save_TexSubImage1D;
table->TexSubImage2D = save_TexSubImage2D;
- table->VertexPointer = _mesa_VertexPointer;
+ table->VertexPointer = exec_VertexPointer;
/* GL 1.2 */
table->CopyTexSubImage3D = save_CopyTexSubImage3D;
@@ -5127,26 +5754,26 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->ConvolutionParameteriv = save_ConvolutionParameteriv;
table->CopyColorSubTable = save_CopyColorSubTable;
table->CopyColorTable = save_CopyColorTable;
- table->CopyConvolutionFilter1D = _mesa_CopyConvolutionFilter1D;
- table->CopyConvolutionFilter2D = _mesa_CopyConvolutionFilter2D;
- table->GetColorTable = _mesa_GetColorTable;
- table->GetColorTableParameterfv = _mesa_GetColorTableParameterfv;
- table->GetColorTableParameteriv = _mesa_GetColorTableParameteriv;
- table->GetConvolutionFilter = _mesa_GetConvolutionFilter;
- table->GetConvolutionParameterfv = _mesa_GetConvolutionParameterfv;
- table->GetConvolutionParameteriv = _mesa_GetConvolutionParameteriv;
- table->GetHistogram = _mesa_GetHistogram;
- table->GetHistogramParameterfv = _mesa_GetHistogramParameterfv;
- table->GetHistogramParameteriv = _mesa_GetHistogramParameteriv;
- table->GetMinmax = _mesa_GetMinmax;
- table->GetMinmaxParameterfv = _mesa_GetMinmaxParameterfv;
- table->GetMinmaxParameteriv = _mesa_GetMinmaxParameteriv;
- table->GetSeparableFilter = _mesa_GetSeparableFilter;
+ table->CopyConvolutionFilter1D = exec_CopyConvolutionFilter1D;
+ table->CopyConvolutionFilter2D = exec_CopyConvolutionFilter2D;
+ table->GetColorTable = exec_GetColorTable;
+ table->GetColorTableParameterfv = exec_GetColorTableParameterfv;
+ table->GetColorTableParameteriv = exec_GetColorTableParameteriv;
+ table->GetConvolutionFilter = exec_GetConvolutionFilter;
+ table->GetConvolutionParameterfv = exec_GetConvolutionParameterfv;
+ table->GetConvolutionParameteriv = exec_GetConvolutionParameteriv;
+ table->GetHistogram = exec_GetHistogram;
+ table->GetHistogramParameterfv = exec_GetHistogramParameterfv;
+ table->GetHistogramParameteriv = exec_GetHistogramParameteriv;
+ table->GetMinmax = exec_GetMinmax;
+ table->GetMinmaxParameterfv = exec_GetMinmaxParameterfv;
+ table->GetMinmaxParameteriv = exec_GetMinmaxParameteriv;
+ table->GetSeparableFilter = exec_GetSeparableFilter;
table->Histogram = save_Histogram;
table->Minmax = save_Minmax;
table->ResetHistogram = save_ResetHistogram;
table->ResetMinmax = save_ResetMinmax;
- table->SeparableFilter2D = _mesa_SeparableFilter2D;
+ table->SeparableFilter2D = exec_SeparableFilter2D;
/* 2. GL_EXT_blend_color */
#if 0
@@ -5171,16 +5798,16 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->PixelTexGenParameterfSGIS = save_PixelTexGenParameterfSGIS;
table->PixelTexGenParameterivSGIS = save_PixelTexGenParameterivSGIS;
table->PixelTexGenParameterfvSGIS = save_PixelTexGenParameterfvSGIS;
- table->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS;
- table->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS;
+ table->GetPixelTexGenParameterivSGIS = exec_GetPixelTexGenParameterivSGIS;
+ table->GetPixelTexGenParameterfvSGIS = exec_GetPixelTexGenParameterfvSGIS;
/* 30. GL_EXT_vertex_array */
- table->ColorPointerEXT = _mesa_ColorPointerEXT;
- table->EdgeFlagPointerEXT = _mesa_EdgeFlagPointerEXT;
- table->IndexPointerEXT = _mesa_IndexPointerEXT;
- table->NormalPointerEXT = _mesa_NormalPointerEXT;
- table->TexCoordPointerEXT = _mesa_TexCoordPointerEXT;
- table->VertexPointerEXT = _mesa_VertexPointerEXT;
+ table->ColorPointerEXT = exec_ColorPointerEXT;
+ table->EdgeFlagPointerEXT = exec_EdgeFlagPointerEXT;
+ table->IndexPointerEXT = exec_IndexPointerEXT;
+ table->NormalPointerEXT = exec_NormalPointerEXT;
+ table->TexCoordPointerEXT = exec_TexCoordPointerEXT;
+ table->VertexPointerEXT = exec_VertexPointerEXT;
/* 37. GL_EXT_blend_minmax */
#if 0
@@ -5199,13 +5826,13 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->ColorTableEXT = save_ColorTable;
table->ColorSubTableEXT = save_ColorSubTable;
#endif
- table->GetColorTableEXT = _mesa_GetColorTable;
- table->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv;
- table->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv;
+ table->GetColorTableEXT = exec_GetColorTable;
+ table->GetColorTableParameterfvEXT = exec_GetColorTableParameterfv;
+ table->GetColorTableParameterivEXT = exec_GetColorTableParameteriv;
/* 97. GL_EXT_compiled_vertex_array */
- table->LockArraysEXT = _mesa_LockArraysEXT;
- table->UnlockArraysEXT = _mesa_UnlockArraysEXT;
+ table->LockArraysEXT = exec_LockArraysEXT;
+ table->UnlockArraysEXT = exec_UnlockArraysEXT;
/* GL_ARB_multitexture */
table->ActiveTextureARB = save_ActiveTextureARB;
@@ -5241,7 +5868,7 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->WindowPos4svMESA = save_WindowPos4svMESA;
/* GL_MESA_resize_buffers */
- table->ResizeBuffersMESA = _mesa_ResizeBuffersMESA;
+ table->ResizeBuffersMESA = exec_ResizeBuffersMESA;
/* GL_ARB_transpose_matrix */
table->LoadTransposeMatrixdARB = save_LoadTransposeMatrixdARB;
@@ -5256,13 +5883,13 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->CompressedTexSubImage3DARB = save_CompressedTexSubImage3DARB;
table->CompressedTexSubImage2DARB = save_CompressedTexSubImage2DARB;
table->CompressedTexSubImage1DARB = save_CompressedTexSubImage1DARB;
- table->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB;
+ table->GetCompressedTexImageARB = exec_GetCompressedTexImageARB;
/* GL_EXT_secondary_color */
- table->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT;
+ table->SecondaryColorPointerEXT = exec_SecondaryColorPointerEXT;
/* GL_EXT_fog_coord */
- table->FogCoordPointerEXT = _mesa_FogCoordPointerEXT;
+ table->FogCoordPointerEXT = exec_FogCoordPointerEXT;
}
diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h
index 5d6faf97af..a8cd34d612 100644
--- a/src/mesa/main/dlist.h
+++ b/src/mesa/main/dlist.h
@@ -1,4 +1,4 @@
-/* $Id: dlist.h,v 1.9 2000/11/24 15:21:59 keithw Exp $ */
+/* $Id: dlist.h,v 1.10 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -32,6 +32,30 @@
#include "mtypes.h"
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
+do { \
+ if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { \
+ gl_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
+ return retval; \
+ } \
+} while (0)
+
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx,)
+
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
+do { \
+ ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
+ FLUSH_VERTICES(ctx, 0); \
+} while (0)
+
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
+do { \
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
+ FLUSH_VERTICES(ctx, 0); \
+} while (0)
+
+
extern void gl_init_lists( void );
extern void gl_destroy_list( GLcontext *ctx, GLuint list );
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 21c74ffdf0..661a41bc2c 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -1,4 +1,4 @@
-/* $Id: drawpix.c,v 1.46 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: drawpix.c,v 1.47 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -53,7 +53,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "_mesa_DrawPixels" );
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->RenderMode==GL_RENDER) {
GLint x, y;
@@ -88,8 +88,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
GLfloat color[4];
GLfloat texcoord[4], invq;
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
-
+ FLUSH_CURRENT(ctx, 0);
color[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]);
color[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]);
color[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]);
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index bbc5070d75..7b66760005 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.36 2000/12/08 00:20:15 brianp Exp $ */
+/* $Id: enable.c,v 1.37 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -44,14 +44,92 @@
#endif
+static void
+client_state( GLcontext *ctx, GLenum cap, GLboolean state )
+{
+ GLuint flag;
+ GLboolean *var;
+
+ switch (cap) {
+ case GL_VERTEX_ARRAY:
+ var = &ctx->Array.Vertex.Enabled;
+ flag = _NEW_ARRAY_VERTEX;
+ break;
+ case GL_NORMAL_ARRAY:
+ var = &ctx->Array.Normal.Enabled;
+ flag = _NEW_ARRAY_NORMAL;
+ break;
+ case GL_COLOR_ARRAY:
+ var = &ctx->Array.Color.Enabled;
+ flag = _NEW_ARRAY_COLOR;
+ break;
+ case GL_INDEX_ARRAY:
+ var = &ctx->Array.Index.Enabled;
+ flag = _NEW_ARRAY_INDEX;
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled;
+ flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture);
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ var = &ctx->Array.EdgeFlag.Enabled;
+ flag = _NEW_ARRAY_EDGEFLAG;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ var = &ctx->Array.FogCoord.Enabled;
+ flag = _NEW_ARRAY_FOGCOORD;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ var = &ctx->Array.SecondaryColor.Enabled;
+ flag = _NEW_ARRAY_SECONDARYCOLOR;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" );
+ }
+
+ if (*var == flag)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ ctx->Array.NewState |= flag;
+ *var = state;
+
+ if (state)
+ ctx->Array._Enabled |= flag;
+ else
+ ctx->Array._Enabled &= ~flag;
+
+ if (ctx->Driver.Enable) {
+ (*ctx->Driver.Enable)( ctx, cap, state );
+ }
+}
+
+
+
+void
+_mesa_EnableClientState( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ client_state( ctx, cap, GL_TRUE );
+}
+
+
+
+void
+_mesa_DisableClientState( GLenum cap )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ client_state( ctx, cap, GL_FALSE );
+}
+
/*
* Perform glEnable and glDisable calls.
*/
void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
{
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" );
-
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "%s %s (newstate is %x)\n",
state ? "glEnable" : "glDisable",
@@ -59,588 +137,610 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
ctx->NewState);
switch (cap) {
- case GL_ALPHA_TEST:
- if (ctx->Color.AlphaEnabled!=state) {
- ctx->Color.AlphaEnabled = state;
- ctx->NewState |= _NEW_COLOR;
- }
- break;
- case GL_AUTO_NORMAL:
- ctx->Eval.AutoNormal = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_BLEND:
- if (ctx->Color.BlendEnabled!=state) {
- ctx->Color.BlendEnabled = state;
- /* The following needed to accomodate 1.0 RGB logic op blending */
- if (ctx->Color.BlendEquation==GL_LOGIC_OP && state) {
- ctx->Color.ColorLogicOpEnabled = GL_TRUE;
- }
- else {
- ctx->Color.ColorLogicOpEnabled = GL_FALSE;
- }
- ctx->NewState |= _NEW_COLOR;
- }
- break;
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- if (ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0] != state)
- {
- GLuint p = cap-GL_CLIP_PLANE0;
-
- ctx->Transform.ClipEnabled[p] = state;
- ctx->NewState |= _NEW_TRANSFORM;
-
- if (state) {
- ctx->_Enabled |= ENABLE_USERCLIP;
- ctx->Transform._AnyClip++;
-
- if (ctx->ProjectionMatrix.flags & MAT_DIRTY) {
- _math_matrix_analyse( &ctx->ProjectionMatrix );
- }
+ case GL_ALPHA_TEST:
+ if (ctx->Color.AlphaEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.AlphaEnabled = state;
+ break;
+ case GL_AUTO_NORMAL:
+ if (ctx->Eval.AutoNormal == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.AutoNormal = state;
+ break;
+ case GL_BLEND:
+ if (ctx->Color.BlendEnabled == state)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.BlendEnabled = state;
+ /* The following needed to accomodate 1.0 RGB logic op blending */
+ ctx->Color.ColorLogicOpEnabled =
+ (ctx->Color.BlendEquation == GL_LOGIC_OP && state);
+ break;
+ case GL_CLIP_PLANE0:
+ case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2:
+ case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4:
+ case GL_CLIP_PLANE5: {
+ GLuint p = cap-GL_CLIP_PLANE0;
+
+ if (ctx->Transform.ClipEnabled[p] == state)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Transform.ClipEnabled[p] = state;
+
+ if (state) {
+ ctx->_Enabled |= ENABLE_USERCLIP;
+ ctx->Transform._AnyClip++;
- /* This derived state also calculated in clip.c and
- * from gl_update_state() on changes to EyeUserPlane
- * and ctx->ProjectionMatrix respectively.
- */
- gl_transform_vector( ctx->Transform._ClipUserPlane[p],
- ctx->Transform.EyeUserPlane[p],
- ctx->ProjectionMatrix.inv );
- } else {
- if (--ctx->Transform._AnyClip == 0)
- ctx->_Enabled &= ~ENABLE_USERCLIP;
- }
- }
- break;
- case GL_COLOR_MATERIAL:
- if (ctx->Light.ColorMaterialEnabled!=state) {
- ctx->Light.ColorMaterialEnabled = state;
- ctx->NewState |= _NEW_LIGHT;
-
- if (state) {
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
- gl_update_color_material( ctx, ctx->Current.Color );
- }
- }
- break;
- case GL_CULL_FACE:
- if (ctx->Polygon.CullFlag!=state) {
- ctx->Polygon.CullFlag = state;
-/* ctx->_TriangleCaps ^= DD_TRI_CULL; */
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_DEPTH_TEST:
- if (state && ctx->Visual.DepthBits==0) {
- _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
- return;
- }
- if (ctx->Depth.Test!=state) {
- ctx->Depth.Test = state;
- ctx->NewState |= _NEW_DEPTH;
- }
- break;
- case GL_DITHER:
- if (ctx->NoDither) {
- /* MESA_NO_DITHER env var */
- state = GL_FALSE;
- }
- if (ctx->Color.DitherFlag!=state) {
- ctx->Color.DitherFlag = state;
- ctx->NewState |= _NEW_COLOR;
- }
- break;
- case GL_FOG:
- if (ctx->Fog.Enabled!=state) {
- ctx->Fog.Enabled = state;
- ctx->_Enabled ^= ENABLE_FOG;
- ctx->NewState |= _NEW_FOG;
- }
- break;
- case GL_HISTOGRAM:
- if (ctx->Extensions.EXT_histogram) {
- ctx->Pixel.HistogramEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
- case GL_LIGHT0:
- case GL_LIGHT1:
- case GL_LIGHT2:
- case GL_LIGHT3:
- case GL_LIGHT4:
- case GL_LIGHT5:
- case GL_LIGHT6:
- case GL_LIGHT7:
- if (ctx->Light.Light[cap-GL_LIGHT0].Enabled != state) {
- ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
- if (state) {
- insert_at_tail(&ctx->Light.EnabledList,
- &ctx->Light.Light[cap-GL_LIGHT0]);
- }
- else {
- remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]);
- }
- ctx->NewState |= _NEW_LIGHT;
+ if (ctx->ProjectionMatrix.flags & MAT_DIRTY) {
+ _math_matrix_analyse( &ctx->ProjectionMatrix );
}
- break;
- case GL_LIGHTING:
- if (ctx->Light.Enabled!=state) {
- ctx->Light.Enabled = state;
- ctx->_Enabled &= ~ENABLE_LIGHT;
- if (state)
- ctx->_Enabled |= ENABLE_LIGHT;
- ctx->NewState |= _NEW_LIGHT;
- }
- break;
- case GL_LINE_SMOOTH:
- if (ctx->Line.SmoothFlag!=state) {
- ctx->Line.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
- ctx->NewState |= _NEW_LINE;
- }
- break;
- case GL_LINE_STIPPLE:
- if (ctx->Line.StippleFlag!=state) {
- ctx->Line.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
- ctx->NewState |= _NEW_LINE;
- }
- break;
- case GL_INDEX_LOGIC_OP:
- if (ctx->Color.IndexLogicOpEnabled!=state) {
- ctx->Color.IndexLogicOpEnabled = state;
- ctx->NewState |= _NEW_COLOR;
- }
- break;
- case GL_COLOR_LOGIC_OP:
- if (ctx->Color.ColorLogicOpEnabled!=state) {
- ctx->Color.ColorLogicOpEnabled = state;
- ctx->NewState |= _NEW_COLOR;
- }
- break;
- case GL_MAP1_COLOR_4:
- ctx->Eval.Map1Color4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_INDEX:
- ctx->Eval.Map1Index = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_NORMAL:
- ctx->Eval.Map1Normal = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- ctx->Eval.Map1TextureCoord1 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- ctx->Eval.Map1TextureCoord2 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- ctx->Eval.Map1TextureCoord3 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- ctx->Eval.Map1TextureCoord4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_VERTEX_3:
- ctx->Eval.Map1Vertex3 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP1_VERTEX_4:
- ctx->Eval.Map1Vertex4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_COLOR_4:
- ctx->Eval.Map2Color4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_INDEX:
- ctx->Eval.Map2Index = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_NORMAL:
- ctx->Eval.Map2Normal = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- ctx->Eval.Map2TextureCoord1 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- ctx->Eval.Map2TextureCoord2 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- ctx->Eval.Map2TextureCoord3 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- ctx->Eval.Map2TextureCoord4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_VERTEX_3:
- ctx->Eval.Map2Vertex3 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MAP2_VERTEX_4:
- ctx->Eval.Map2Vertex4 = state;
- ctx->NewState |= _NEW_EVAL;
- break;
- case GL_MINMAX:
- ctx->Pixel.MinMaxEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- break;
- case GL_NORMALIZE:
- if (ctx->Transform.Normalize != state) {
- ctx->Transform.Normalize = state;
- ctx->NewState |= _NEW_TRANSFORM;
- ctx->_Enabled ^= ENABLE_NORMALIZE;
- }
- break;
- case GL_POINT_SMOOTH:
- if (ctx->Point.SmoothFlag!=state) {
- ctx->Point.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
- ctx->NewState |= _NEW_POINT;
- }
- break;
- case GL_POLYGON_SMOOTH:
- if (ctx->Polygon.SmoothFlag!=state) {
- ctx->Polygon.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_POLYGON_STIPPLE:
- if (ctx->Polygon.StippleFlag!=state) {
- ctx->Polygon.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_POLYGON_OFFSET_POINT:
- if (ctx->Polygon.OffsetPoint!=state) {
- ctx->Polygon.OffsetPoint = state;
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_POLYGON_OFFSET_LINE:
- if (ctx->Polygon.OffsetLine!=state) {
- ctx->Polygon.OffsetLine = state;
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_POLYGON_OFFSET_FILL:
+
+ /* This derived state also calculated in clip.c and
+ * from gl_update_state() on changes to EyeUserPlane
+ * and ctx->ProjectionMatrix respectively.
+ */
+ gl_transform_vector( ctx->Transform._ClipUserPlane[p],
+ ctx->Transform.EyeUserPlane[p],
+ ctx->ProjectionMatrix.inv );
+ } else {
+ if (--ctx->Transform._AnyClip == 0)
+ ctx->_Enabled &= ~ENABLE_USERCLIP;
+ }
+ }
+ break;
+ case GL_COLOR_MATERIAL:
+ if (ctx->Light.ColorMaterialEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.ColorMaterialEnabled = state;
+ if (state) {
+ FLUSH_CURRENT(ctx, 0);
+ gl_update_color_material( ctx, ctx->Current.Color );
+ }
+ break;
+ case GL_CULL_FACE:
+ if (ctx->Polygon.CullFlag == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.CullFlag = state;
+ break;
+ case GL_DEPTH_TEST:
+ if (state && ctx->Visual.DepthBits==0) {
+ _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
+ return;
+ }
+ if (ctx->Depth.Test==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.Test = state;
+ break;
+ case GL_DITHER:
+ if (ctx->NoDither) {
+ state = GL_FALSE; /* MESA_NO_DITHER env var */
+ }
+ if (ctx->Color.DitherFlag==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.DitherFlag = state;
+ break;
+ case GL_FOG:
+ if (ctx->Fog.Enabled==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.Enabled = state;
+ ctx->_Enabled ^= ENABLE_FOG;
+ break;
+ case GL_HISTOGRAM:
+ if (!ctx->Extensions.EXT_histogram) {
+ gl_error(ctx, GL_INVALID_ENUM, "enable GL_HISTOGRAM");
+ return;
+ }
+ if (ctx->Pixel.HistogramEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.HistogramEnabled = state;
+ break;
+ case GL_LIGHT0:
+ case GL_LIGHT1:
+ case GL_LIGHT2:
+ case GL_LIGHT3:
+ case GL_LIGHT4:
+ case GL_LIGHT5:
+ case GL_LIGHT6:
+ case GL_LIGHT7:
+ if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
+ if (state) {
+ insert_at_tail(&ctx->Light.EnabledList,
+ &ctx->Light.Light[cap-GL_LIGHT0]);
+ }
+ else {
+ remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]);
+ }
+ break;
+ case GL_LIGHTING:
+ if (ctx->Light.Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Enabled = state;
+ ctx->_Enabled ^= ENABLE_LIGHT;
+ break;
+ case GL_LINE_SMOOTH:
+ if (ctx->Line.SmoothFlag == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LINE);
+ ctx->Line.SmoothFlag = state;
+ ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
+ break;
+ case GL_LINE_STIPPLE:
+ if (ctx->Line.StippleFlag == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LINE);
+ ctx->Line.StippleFlag = state;
+ ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
+ break;
+ case GL_INDEX_LOGIC_OP:
+ if (ctx->Color.IndexLogicOpEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.IndexLogicOpEnabled = state;
+ break;
+ case GL_COLOR_LOGIC_OP:
+ if (ctx->Color.ColorLogicOpEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.ColorLogicOpEnabled = state;
+ break;
+ case GL_MAP1_COLOR_4:
+ if (ctx->Eval.Map1Color4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Color4 = state;
+ break;
+ case GL_MAP1_INDEX:
+ if (ctx->Eval.Map1Index == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Index = state;
+ break;
+ case GL_MAP1_NORMAL:
+ if (ctx->Eval.Map1Normal == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Normal = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_1:
+ if (ctx->Eval.Map1TextureCoord1 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord1 = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_2:
+ if (ctx->Eval.Map1TextureCoord2 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord2 = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_3:
+ if (ctx->Eval.Map1TextureCoord3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord3 = state;
+ break;
+ case GL_MAP1_TEXTURE_COORD_4:
+ if (ctx->Eval.Map1TextureCoord4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1TextureCoord4 = state;
+ break;
+ case GL_MAP1_VERTEX_3:
+ if (ctx->Eval.Map1Vertex3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Vertex3 = state;
+ break;
+ case GL_MAP1_VERTEX_4:
+ if (ctx->Eval.Map1Vertex4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map1Vertex4 = state;
+ break;
+ case GL_MAP2_COLOR_4:
+ if (ctx->Eval.Map2Color4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Color4 = state;
+ break;
+ case GL_MAP2_INDEX:
+ if (ctx->Eval.Map2Index == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Index = state;
+ break;
+ case GL_MAP2_NORMAL:
+ if (ctx->Eval.Map2Normal == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Normal = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_1:
+ if (ctx->Eval.Map2TextureCoord1 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord1 = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_2:
+ if (ctx->Eval.Map2TextureCoord2 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord2 = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_3:
+ if (ctx->Eval.Map2TextureCoord3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord3 = state;
+ break;
+ case GL_MAP2_TEXTURE_COORD_4:
+ if (ctx->Eval.Map2TextureCoord4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2TextureCoord4 = state;
+ break;
+ case GL_MAP2_VERTEX_3:
+ if (ctx->Eval.Map2Vertex3 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Vertex3 = state;
+ break;
+ case GL_MAP2_VERTEX_4:
+ if (ctx->Eval.Map2Vertex4 == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ ctx->Eval.Map2Vertex4 = state;
+ break;
+ case GL_MINMAX:
+ if (ctx->Pixel.MinMaxEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.MinMaxEnabled = state;
+ break;
+ case GL_NORMALIZE:
+ if (ctx->Transform.Normalize == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Transform.Normalize = state;
+ ctx->_Enabled ^= ENABLE_NORMALIZE;
+ break;
+ case GL_POINT_SMOOTH:
+ if (ctx->Point.SmoothFlag==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.SmoothFlag = state;
+ ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
+ break;
+ case GL_POLYGON_SMOOTH:
+ if (ctx->Polygon.SmoothFlag==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.SmoothFlag = state;
+ ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
+ break;
+ case GL_POLYGON_STIPPLE:
+ if (ctx->Polygon.StippleFlag==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.StippleFlag = state;
+ ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
+ break;
+ case GL_POLYGON_OFFSET_POINT:
+ if (ctx->Polygon.OffsetPoint==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.OffsetPoint = state;
+ break;
+ case GL_POLYGON_OFFSET_LINE:
+ if (ctx->Polygon.OffsetLine==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.OffsetLine = state;
+ break;
+ case GL_POLYGON_OFFSET_FILL:
/*case GL_POLYGON_OFFSET_EXT:*/
- if (ctx->Polygon.OffsetFill!=state) {
- ctx->Polygon.OffsetFill = state;
- ctx->NewState |= _NEW_POLYGON;
- }
- break;
- case GL_RESCALE_NORMAL_EXT:
- if (ctx->Transform.RescaleNormals != state) {
- ctx->Transform.RescaleNormals = state;
- ctx->NewState |= _NEW_TRANSFORM;
- ctx->_Enabled ^= ENABLE_RESCALE;
- }
- break;
- case GL_SCISSOR_TEST:
- if (ctx->Scissor.Enabled!=state) {
- ctx->Scissor.Enabled = state;
- ctx->NewState |= _NEW_SCISSOR;
- }
- break;
- case GL_SHARED_TEXTURE_PALETTE_EXT:
- ctx->Texture.SharedPalette = state;
- ctx->NewState |= _NEW_TEXTURE;
- break;
- case GL_STENCIL_TEST:
- if (state && ctx->Visual.StencilBits==0) {
- _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer");
- return;
- }
- if (ctx->Stencil.Enabled!=state) {
- ctx->Stencil.Enabled = state;
- ctx->NewState |= _NEW_STENCIL;
- ctx->_TriangleCaps ^= DD_STENCIL;
- }
- break;
- case GL_TEXTURE_1D:
- if (ctx->Visual.RGBAflag) {
- const GLuint curr = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- ctx->NewState |= _NEW_TEXTURE;
- if (state) {
- texUnit->Enabled |= TEXTURE0_1D;
- }
- else {
- texUnit->Enabled &= ~TEXTURE0_1D;
- }
- }
- break;
- case GL_TEXTURE_2D:
- if (ctx->Visual.RGBAflag) {
- const GLuint curr = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- ctx->NewState |= _NEW_TEXTURE;
- if (state) {
- texUnit->Enabled |= TEXTURE0_2D;
- }
- else {
- texUnit->Enabled &= ~TEXTURE0_2D;
- }
- }
- break;
- case GL_TEXTURE_3D:
- if (ctx->Visual.RGBAflag) {
- const GLuint curr = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- ctx->NewState |= _NEW_TEXTURE;
- if (state) {
- texUnit->Enabled |= TEXTURE0_3D;
- }
- else {
- texUnit->Enabled &= ~TEXTURE0_3D;
- }
- }
- break;
- case GL_TEXTURE_GEN_Q:
- {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- if (state)
- texUnit->TexGenEnabled |= Q_BIT;
- else
- texUnit->TexGenEnabled &= ~Q_BIT;
- ctx->NewState |= _NEW_TEXTURE;
- }
- break;
- case GL_TEXTURE_GEN_R:
- {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- if (state)
- texUnit->TexGenEnabled |= R_BIT;
- else
- texUnit->TexGenEnabled &= ~R_BIT;
- ctx->NewState |= _NEW_TEXTURE;
- }
- break;
- case GL_TEXTURE_GEN_S:
- {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- if (state)
- texUnit->TexGenEnabled |= S_BIT;
- else
- texUnit->TexGenEnabled &= ~S_BIT;
- ctx->NewState |= _NEW_TEXTURE;
- }
- break;
- case GL_TEXTURE_GEN_T:
- {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- if (state)
- texUnit->TexGenEnabled |= T_BIT;
- else
- texUnit->TexGenEnabled &= ~T_BIT;
- ctx->NewState |= _NEW_TEXTURE;
- }
- break;
-
- /*
- * CLIENT STATE!!!
- */
- case GL_VERTEX_ARRAY:
- ctx->Array.Vertex.Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
- case GL_NORMAL_ARRAY:
- ctx->Array.Normal.Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
- case GL_COLOR_ARRAY:
- ctx->Array.Color.Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
- case GL_INDEX_ARRAY:
- ctx->Array.Index.Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
- case GL_TEXTURE_COORD_ARRAY:
- ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
- case GL_EDGE_FLAG_ARRAY:
- ctx->Array.EdgeFlag.Enabled = state;
- ctx->NewState |= _NEW_ARRAY;
- break;
+ if (ctx->Polygon.OffsetFill==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.OffsetFill = state;
+ break;
+ case GL_RESCALE_NORMAL_EXT:
+ if (ctx->Transform.RescaleNormals == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Transform.RescaleNormals = state;
+ ctx->_Enabled ^= ENABLE_RESCALE;
+ break;
+ case GL_SCISSOR_TEST:
+ if (ctx->Scissor.Enabled==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_SCISSOR);
+ ctx->Scissor.Enabled = state;
+ break;
+ case GL_SHARED_TEXTURE_PALETTE_EXT:
+ if (ctx->Texture.SharedPalette == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ ctx->Texture.SharedPalette = state;
+ break;
+ case GL_STENCIL_TEST:
+ if (state && ctx->Visual.StencilBits==0) {
+ _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer");
+ return;
+ }
+ if (ctx->Stencil.Enabled==state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.Enabled = state;
+ ctx->_TriangleCaps ^= DD_STENCIL;
+ break;
+ case GL_TEXTURE_1D: {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE0_1D;
+ if (state)
+ newenabled |= TEXTURE0_1D;
+ if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_2D: {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE0_2D;
+ if (state)
+ newenabled |= TEXTURE0_2D;
+ if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_3D: {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE0_3D;
+ if (state)
+ newenabled |= TEXTURE0_3D;
+ if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_GEN_Q: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT;
+ if (state)
+ newenabled |= Q_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+ case GL_TEXTURE_GEN_R: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT;
+ if (state)
+ newenabled |= R_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+ break;
+ case GL_TEXTURE_GEN_S: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT;
+ if (state)
+ newenabled |= S_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+ break;
+ case GL_TEXTURE_GEN_T: {
+ GLuint unit = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT;
+ if (state)
+ newenabled |= T_BIT;
+ if (texUnit->TexGenEnabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->TexGenEnabled = newenabled;
+ break;
+ }
+ break;
+
+ /*
+ * CLIENT STATE!!!
+ */
+ case GL_VERTEX_ARRAY:
+ case GL_NORMAL_ARRAY:
+ case GL_COLOR_ARRAY:
+ case GL_INDEX_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY:
+ case GL_EDGE_FLAG_ARRAY:
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ client_state( ctx, cap, state );
+ return;
/* GL_HP_occlusion_test */
- case GL_OCCLUSION_TEST_HP:
- if (ctx->Extensions.HP_occlusion_test) {
- ctx->Depth.OcclusionTest = state;
- ctx->NewState |= _NEW_DEPTH;
- if (state)
- ctx->OcclusionResult = ctx->OcclusionResultSaved;
- else
- ctx->OcclusionResultSaved = ctx->OcclusionResult;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
+ case GL_OCCLUSION_TEST_HP:
+ if (!ctx->Extensions.HP_occlusion_test) {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
+ if (ctx->Depth.OcclusionTest == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.OcclusionTest = state;
+ if (state)
+ ctx->OcclusionResult = ctx->OcclusionResultSaved;
+ else
+ ctx->OcclusionResultSaved = ctx->OcclusionResult;
+ break;
/* GL_SGIS_pixel_texture */
- case GL_PIXEL_TEXTURE_SGIS:
- if (ctx->Extensions.SGIS_pixel_texture) {
- ctx->Pixel.PixelTextureEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
+ case GL_PIXEL_TEXTURE_SGIS:
+ if (!ctx->Extensions.SGIS_pixel_texture) {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
+ if (ctx->Pixel.PixelTextureEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PixelTextureEnabled = state;
+ break;
/* GL_SGIX_pixel_texture */
- case GL_PIXEL_TEX_GEN_SGIX:
- if (ctx->Extensions.SGIX_pixel_texture) {
- ctx->Pixel.PixelTextureEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
+ case GL_PIXEL_TEX_GEN_SGIX:
+ if (!ctx->Extensions.SGIX_pixel_texture) {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
+ if (ctx->Pixel.PixelTextureEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PixelTextureEnabled = state;
+ break;
/* GL_SGI_color_table */
- case GL_COLOR_TABLE_SGI:
- if (ctx->Extensions.SGI_color_table) {
- ctx->Pixel.ColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
- case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
- if (ctx->Extensions.SGI_color_table) {
- ctx->Pixel.PostConvolutionColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
- case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
- if (ctx->Extensions.SGI_color_table) {
- ctx->Pixel.PostColorMatrixColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
- return;
- }
- break;
+ case GL_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_color_table) {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
+ if (ctx->Pixel.ColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.ColorTableEnabled = state;
+ break;
+ case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_color_table) {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
+ if (ctx->Pixel.PostConvolutionColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostConvolutionColorTableEnabled = state;
+ break;
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_color_table) {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
+ if (ctx->Pixel.PostColorMatrixColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.PostColorMatrixColorTableEnabled = state;
+ break;
/* GL_EXT_convolution */
- case GL_CONVOLUTION_1D:
- if (ctx->Extensions.EXT_convolution) {
- ctx->Pixel.Convolution1DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
- case GL_CONVOLUTION_2D:
- if (ctx->Extensions.EXT_convolution) {
- ctx->Pixel.Convolution2DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
- case GL_SEPARABLE_2D:
- if (ctx->Extensions.EXT_convolution) {
- ctx->Pixel.Separable2DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
+ case GL_CONVOLUTION_1D:
+ if (!ctx->Extensions.EXT_convolution) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Pixel.Convolution1DEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.Convolution1DEnabled = state;
+ break;
+ case GL_CONVOLUTION_2D:
+ if (!ctx->Extensions.EXT_convolution) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Pixel.Convolution2DEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.Convolution2DEnabled = state;
+ break;
+ case GL_SEPARABLE_2D:
+ if (!ctx->Extensions.EXT_convolution) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Pixel.Separable2DEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.Separable2DEnabled = state;
+ break;
/* GL_ARB_texture_cube_map */
- case GL_TEXTURE_CUBE_MAP_ARB:
- if (ctx->Extensions.ARB_texture_cube_map) {
- if (ctx->Visual.RGBAflag) {
- const GLuint curr = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- ctx->NewState |= _NEW_TEXTURE;
- if (state) {
- texUnit->Enabled |= TEXTURE0_CUBE;
- }
- else {
- texUnit->Enabled &= ~TEXTURE0_CUBE;
- }
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
-
+ case GL_TEXTURE_CUBE_MAP_ARB: {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE0_CUBE;
+ if (state)
+ newenabled |= TEXTURE0_CUBE;
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ break;
+ }
/* GL_EXT_secondary_color */
- case GL_COLOR_SUM_EXT:
- if (ctx->Extensions.EXT_secondary_color) {
- ctx->Fog.ColorSumEnabled = state;
- if (state)
- SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
- else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR)
- CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
- ctx->NewState |= _NEW_FOG;
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
+ case GL_COLOR_SUM_EXT:
+ if (!ctx->Extensions.EXT_secondary_color) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Fog.ColorSumEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.ColorSumEnabled = state;
+ ctx->_TriangleCaps ^= DD_SEPERATE_SPECULAR;
+ break;
/* GL_MESA_sprite_point */
- case GL_SPRITE_POINT_MESA:
- if (ctx->Extensions.MESA_sprite_point) {
- ctx->Point.SpriteMode = state;
- ctx->NewState |= _NEW_POINT;
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
- }
- break;
-
- default:
- gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
- return;
+ case GL_SPRITE_POINT_MESA:
+ if (!ctx->Extensions.MESA_sprite_point) {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Point.SpriteMode == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.SpriteMode = state;
+ break;
+
+ default:
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
}
if (ctx->Driver.Enable) {
@@ -895,61 +995,6 @@ _mesa_IsEnabled( GLenum cap )
-static void
-client_state( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx,
- (state
- ? "glEnableClientState"
- : "glDisableClientState") );
-
- switch (cap) {
- case GL_VERTEX_ARRAY:
- ctx->Array.Vertex.Enabled = state;
- break;
- case GL_NORMAL_ARRAY:
- ctx->Array.Normal.Enabled = state;
- break;
- case GL_COLOR_ARRAY:
- ctx->Array.Color.Enabled = state;
- break;
- case GL_INDEX_ARRAY:
- ctx->Array.Index.Enabled = state;
- break;
- case GL_TEXTURE_COORD_ARRAY:
- ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state;
- break;
- case GL_EDGE_FLAG_ARRAY:
- ctx->Array.EdgeFlag.Enabled = state;
- break;
- case GL_FOG_COORDINATE_ARRAY_EXT:
- ctx->Array.FogCoord.Enabled = state;
- break;
- case GL_SECONDARY_COLOR_ARRAY_EXT:
- ctx->Array.SecondaryColor.Enabled = state;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" );
- }
-
- ctx->NewState |= _NEW_ARRAY;
-}
-
-void
-_mesa_EnableClientState( GLenum cap )
-{
- GET_CURRENT_CONTEXT(ctx);
- client_state( ctx, cap, GL_TRUE );
-}
-
-
-
-void
-_mesa_DisableClientState( GLenum cap )
-{
- GET_CURRENT_CONTEXT(ctx);
- client_state( ctx, cap, GL_FALSE );
-}
diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c
index 8bf8929e78..3d5e4c7205 100644
--- a/src/mesa/main/eval.c
+++ b/src/mesa/main/eval.c
@@ -1,4 +1,4 @@
-/* $Id: eval.c,v 1.16 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: eval.c,v 1.17 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -234,104 +234,6 @@ GLfloat *gl_copy_map_points2d(GLenum target,
}
-#if 00
-/*
- * This function is called by the display list deallocator function to
- * specify that a given set of control points are no longer needed.
- */
-void gl_free_control_points( GLcontext* ctx, GLenum target, GLfloat *data )
-{
- struct gl_1d_map *map1 = NULL;
- struct gl_2d_map *map2 = NULL;
-
- switch (target) {
- case GL_MAP1_VERTEX_3:
- map1 = &ctx->EvalMap.Map1Vertex3;
- break;
- case GL_MAP1_VERTEX_4:
- map1 = &ctx->EvalMap.Map1Vertex4;
- break;
- case GL_MAP1_INDEX:
- map1 = &ctx->EvalMap.Map1Index;
- break;
- case GL_MAP1_COLOR_4:
- map1 = &ctx->EvalMap.Map1Color4;
- break;
- case GL_MAP1_NORMAL:
- map1 = &ctx->EvalMap.Map1Normal;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- map1 = &ctx->EvalMap.Map1Texture1;
- break;
- case GL_MAP1_TEXTURE_COORD_2:
- map1 = &ctx->EvalMap.Map1Texture2;
- break;
- case GL_MAP1_TEXTURE_COORD_3:
- map1 = &ctx->EvalMap.Map1Texture3;
- break;
- case GL_MAP1_TEXTURE_COORD_4:
- map1 = &ctx->EvalMap.Map1Texture4;
- break;
- case GL_MAP2_VERTEX_3:
- map2 = &ctx->EvalMap.Map2Vertex3;
- break;
- case GL_MAP2_VERTEX_4:
- map2 = &ctx->EvalMap.Map2Vertex4;
- break;
- case GL_MAP2_INDEX:
- map2 = &ctx->EvalMap.Map2Index;
- break;
- case GL_MAP2_COLOR_4:
- map2 = &ctx->EvalMap.Map2Color4;
- break;
- case GL_MAP2_NORMAL:
- map2 = &ctx->EvalMap.Map2Normal;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- map2 = &ctx->EvalMap.Map2Texture1;
- break;
- case GL_MAP2_TEXTURE_COORD_2:
- map2 = &ctx->EvalMap.Map2Texture2;
- break;
- case GL_MAP2_TEXTURE_COORD_3:
- map2 = &ctx->EvalMap.Map2Texture3;
- break;
- case GL_MAP2_TEXTURE_COORD_4:
- map2 = &ctx->EvalMap.Map2Texture4;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "gl_free_control_points" );
- return;
- }
-
- if (map1) {
- if (data==map1->Points) {
- /* The control points in the display list are currently */
- /* being used so we can mark them as discard-able. */
- map1->Retain = GL_FALSE;
- }
- else {
- /* The control points in the display list are not currently */
- /* being used. */
- FREE( data );
- }
- }
- if (map2) {
- if (data==map2->Points) {
- /* The control points in the display list are currently */
- /* being used so we can mark them as discard-able. */
- map2->Retain = GL_FALSE;
- }
- else {
- /* The control points in the display list are not currently */
- /* being used. */
- FREE( data );
- }
- }
-
-}
-#endif
-
/**********************************************************************/
@@ -349,8 +251,8 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
GET_CURRENT_CONTEXT(ctx);
GLint k;
GLfloat *pnts;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap1");
+ struct gl_1d_map *map = 0;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
assert(type == GL_FLOAT || type == GL_DOUBLE);
@@ -377,99 +279,54 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
return;
}
- /* make copy of the control points */
- if (type == GL_FLOAT)
- pnts = gl_copy_map_points1f(target, ustride, uorder, (GLfloat*) points);
- else
- pnts = gl_copy_map_points1d(target, ustride, uorder, (GLdouble*) points);
-
switch (target) {
case GL_MAP1_VERTEX_3:
- ctx->EvalMap.Map1Vertex3.Order = uorder;
- ctx->EvalMap.Map1Vertex3.u1 = u1;
- ctx->EvalMap.Map1Vertex3.u2 = u2;
- ctx->EvalMap.Map1Vertex3.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Vertex3.Points)
- FREE( ctx->EvalMap.Map1Vertex3.Points );
- ctx->EvalMap.Map1Vertex3.Points = pnts;
+ map = &ctx->EvalMap.Map1Vertex3;
break;
case GL_MAP1_VERTEX_4:
- ctx->EvalMap.Map1Vertex4.Order = uorder;
- ctx->EvalMap.Map1Vertex4.u1 = u1;
- ctx->EvalMap.Map1Vertex4.u2 = u2;
- ctx->EvalMap.Map1Vertex4.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Vertex4.Points)
- FREE( ctx->EvalMap.Map1Vertex4.Points );
- ctx->EvalMap.Map1Vertex4.Points = pnts;
+ map = &ctx->EvalMap.Map1Vertex4;
break;
case GL_MAP1_INDEX:
- ctx->EvalMap.Map1Index.Order = uorder;
- ctx->EvalMap.Map1Index.u1 = u1;
- ctx->EvalMap.Map1Index.u2 = u2;
- ctx->EvalMap.Map1Index.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Index.Points)
- FREE( ctx->EvalMap.Map1Index.Points );
- ctx->EvalMap.Map1Index.Points = pnts;
+ map = &ctx->EvalMap.Map1Index;
break;
case GL_MAP1_COLOR_4:
- ctx->EvalMap.Map1Color4.Order = uorder;
- ctx->EvalMap.Map1Color4.u1 = u1;
- ctx->EvalMap.Map1Color4.u2 = u2;
- ctx->EvalMap.Map1Color4.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Color4.Points)
- FREE( ctx->EvalMap.Map1Color4.Points );
- ctx->EvalMap.Map1Color4.Points = pnts;
+ map = &ctx->EvalMap.Map1Color4;
break;
case GL_MAP1_NORMAL:
- ctx->EvalMap.Map1Normal.Order = uorder;
- ctx->EvalMap.Map1Normal.u1 = u1;
- ctx->EvalMap.Map1Normal.u2 = u2;
- ctx->EvalMap.Map1Normal.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Normal.Points)
- FREE( ctx->EvalMap.Map1Normal.Points );
- ctx->EvalMap.Map1Normal.Points = pnts;
+ map = &ctx->EvalMap.Map1Normal;
break;
case GL_MAP1_TEXTURE_COORD_1:
- ctx->EvalMap.Map1Texture1.Order = uorder;
- ctx->EvalMap.Map1Texture1.u1 = u1;
- ctx->EvalMap.Map1Texture1.u2 = u2;
- ctx->EvalMap.Map1Texture1.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Texture1.Points)
- FREE( ctx->EvalMap.Map1Texture1.Points );
- ctx->EvalMap.Map1Texture1.Points = pnts;
+ map = &ctx->EvalMap.Map1Texture1;
break;
case GL_MAP1_TEXTURE_COORD_2:
- ctx->EvalMap.Map1Texture2.Order = uorder;
- ctx->EvalMap.Map1Texture2.u1 = u1;
- ctx->EvalMap.Map1Texture2.u2 = u2;
- ctx->EvalMap.Map1Texture2.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Texture2.Points)
- FREE( ctx->EvalMap.Map1Texture2.Points );
- ctx->EvalMap.Map1Texture2.Points = pnts;
+ map = &ctx->EvalMap.Map1Texture2;
break;
case GL_MAP1_TEXTURE_COORD_3:
- ctx->EvalMap.Map1Texture3.Order = uorder;
- ctx->EvalMap.Map1Texture3.u1 = u1;
- ctx->EvalMap.Map1Texture3.u2 = u2;
- ctx->EvalMap.Map1Texture3.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Texture3.Points)
- FREE( ctx->EvalMap.Map1Texture3.Points );
- ctx->EvalMap.Map1Texture3.Points = pnts;
+ map = &ctx->EvalMap.Map1Texture3;
break;
case GL_MAP1_TEXTURE_COORD_4:
- ctx->EvalMap.Map1Texture4.Order = uorder;
- ctx->EvalMap.Map1Texture4.u1 = u1;
- ctx->EvalMap.Map1Texture4.u2 = u2;
- ctx->EvalMap.Map1Texture4.du = 1.0 / (u2 - u1);
- if (ctx->EvalMap.Map1Texture4.Points)
- FREE( ctx->EvalMap.Map1Texture4.Points );
- ctx->EvalMap.Map1Texture4.Points = pnts;
+ map = &ctx->EvalMap.Map1Texture4;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
+ return;
}
- ctx->NewState |= _NEW_EVAL;
+ /* make copy of the control points */
+ if (type == GL_FLOAT)
+ pnts = gl_copy_map_points1f(target, ustride, uorder, (GLfloat*) points);
+ else
+ pnts = gl_copy_map_points1d(target, ustride, uorder, (GLdouble*) points);
+
+
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ map->Order = uorder;
+ map->u1 = u1;
+ map->u2 = u2;
+ map->du = 1.0 / (u2 - u1);
+ if (map->Points)
+ FREE( map->Points );
+ map->Points = pnts;
}
@@ -498,8 +355,8 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
GET_CURRENT_CONTEXT(ctx);
GLint k;
GLfloat *pnts;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap2");
+ struct gl_2d_map *map = 0;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (u1==u2) {
gl_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" );
@@ -535,137 +392,60 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
return;
}
- /* make copy of the control points */
- if (type == GL_FLOAT)
- pnts = gl_copy_map_points2f(target, ustride, uorder,
- vstride, vorder, (GLfloat*) points);
- else
- pnts = gl_copy_map_points2d(target, ustride, uorder,
- vstride, vorder, (GLdouble*) points);
-
switch (target) {
case GL_MAP2_VERTEX_3:
- ctx->EvalMap.Map2Vertex3.Uorder = uorder;
- ctx->EvalMap.Map2Vertex3.u1 = u1;
- ctx->EvalMap.Map2Vertex3.u2 = u2;
- ctx->EvalMap.Map2Vertex3.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Vertex3.Vorder = vorder;
- ctx->EvalMap.Map2Vertex3.v1 = v1;
- ctx->EvalMap.Map2Vertex3.v2 = v2;
- ctx->EvalMap.Map2Vertex3.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Vertex3.Points)
- FREE( ctx->EvalMap.Map2Vertex3.Points );
- ctx->EvalMap.Map2Vertex3.Points = pnts;
+ map = &ctx->EvalMap.Map2Vertex3;
break;
case GL_MAP2_VERTEX_4:
- ctx->EvalMap.Map2Vertex4.Uorder = uorder;
- ctx->EvalMap.Map2Vertex4.u1 = u1;
- ctx->EvalMap.Map2Vertex4.u2 = u2;
- ctx->EvalMap.Map2Vertex4.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Vertex4.Vorder = vorder;
- ctx->EvalMap.Map2Vertex4.v1 = v1;
- ctx->EvalMap.Map2Vertex4.v2 = v2;
- ctx->EvalMap.Map2Vertex4.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Vertex4.Points)
- FREE( ctx->EvalMap.Map2Vertex4.Points );
- ctx->EvalMap.Map2Vertex4.Points = pnts;
+ map = &ctx->EvalMap.Map2Vertex4;
break;
case GL_MAP2_INDEX:
- ctx->EvalMap.Map2Index.Uorder = uorder;
- ctx->EvalMap.Map2Index.u1 = u1;
- ctx->EvalMap.Map2Index.u2 = u2;
- ctx->EvalMap.Map2Index.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Index.Vorder = vorder;
- ctx->EvalMap.Map2Index.v1 = v1;
- ctx->EvalMap.Map2Index.v2 = v2;
- ctx->EvalMap.Map2Index.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Index.Points)
- FREE( ctx->EvalMap.Map2Index.Points );
- ctx->EvalMap.Map2Index.Points = pnts;
+ map = &ctx->EvalMap.Map2Index;
break;
case GL_MAP2_COLOR_4:
- ctx->EvalMap.Map2Color4.Uorder = uorder;
- ctx->EvalMap.Map2Color4.u1 = u1;
- ctx->EvalMap.Map2Color4.u2 = u2;
- ctx->EvalMap.Map2Color4.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Color4.Vorder = vorder;
- ctx->EvalMap.Map2Color4.v1 = v1;
- ctx->EvalMap.Map2Color4.v2 = v2;
- ctx->EvalMap.Map2Color4.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Color4.Points)
- FREE( ctx->EvalMap.Map2Color4.Points );
- ctx->EvalMap.Map2Color4.Points = pnts;
+ map = &ctx->EvalMap.Map2Color4;
break;
case GL_MAP2_NORMAL:
- ctx->EvalMap.Map2Normal.Uorder = uorder;
- ctx->EvalMap.Map2Normal.u1 = u1;
- ctx->EvalMap.Map2Normal.u2 = u2;
- ctx->EvalMap.Map2Normal.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Normal.Vorder = vorder;
- ctx->EvalMap.Map2Normal.v1 = v1;
- ctx->EvalMap.Map2Normal.v2 = v2;
- ctx->EvalMap.Map2Normal.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Normal.Points)
- FREE( ctx->EvalMap.Map2Normal.Points );
- ctx->EvalMap.Map2Normal.Points = pnts;
+ map = &ctx->EvalMap.Map2Normal;
break;
case GL_MAP2_TEXTURE_COORD_1:
- ctx->EvalMap.Map2Texture1.Uorder = uorder;
- ctx->EvalMap.Map2Texture1.u1 = u1;
- ctx->EvalMap.Map2Texture1.u2 = u2;
- ctx->EvalMap.Map2Texture1.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Texture1.Vorder = vorder;
- ctx->EvalMap.Map2Texture1.v1 = v1;
- ctx->EvalMap.Map2Texture1.v2 = v2;
- ctx->EvalMap.Map2Texture1.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Texture1.Points)
- FREE( ctx->EvalMap.Map2Texture1.Points );
- ctx->EvalMap.Map2Texture1.Points = pnts;
+ map = &ctx->EvalMap.Map2Texture1;
break;
case GL_MAP2_TEXTURE_COORD_2:
- ctx->EvalMap.Map2Texture2.Uorder = uorder;
- ctx->EvalMap.Map2Texture2.u1 = u1;
- ctx->EvalMap.Map2Texture2.u2 = u2;
- ctx->EvalMap.Map2Texture2.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Texture2.Vorder = vorder;
- ctx->EvalMap.Map2Texture2.v1 = v1;
- ctx->EvalMap.Map2Texture2.v2 = v2;
- ctx->EvalMap.Map2Texture2.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Texture2.Points)
- FREE( ctx->EvalMap.Map2Texture2.Points );
- ctx->EvalMap.Map2Texture2.Points = pnts;
+ map = &ctx->EvalMap.Map2Texture2;
break;
case GL_MAP2_TEXTURE_COORD_3:
- ctx->EvalMap.Map2Texture3.Uorder = uorder;
- ctx->EvalMap.Map2Texture3.u1 = u1;
- ctx->EvalMap.Map2Texture3.u2 = u2;
- ctx->EvalMap.Map2Texture3.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Texture3.Vorder = vorder;
- ctx->EvalMap.Map2Texture3.v1 = v1;
- ctx->EvalMap.Map2Texture3.v2 = v2;
- ctx->EvalMap.Map2Texture3.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Texture3.Points)
- FREE( ctx->EvalMap.Map2Texture3.Points );
- ctx->EvalMap.Map2Texture3.Points = pnts;
+ map = &ctx->EvalMap.Map2Texture3;
break;
case GL_MAP2_TEXTURE_COORD_4:
- ctx->EvalMap.Map2Texture4.Uorder = uorder;
- ctx->EvalMap.Map2Texture4.u1 = u1;
- ctx->EvalMap.Map2Texture4.u2 = u2;
- ctx->EvalMap.Map2Texture4.du = 1.0 / (u2 - u1);
- ctx->EvalMap.Map2Texture4.Vorder = vorder;
- ctx->EvalMap.Map2Texture4.v1 = v1;
- ctx->EvalMap.Map2Texture4.v2 = v2;
- ctx->EvalMap.Map2Texture4.dv = 1.0 / (v2 - v1);
- if (ctx->EvalMap.Map2Texture4.Points)
- FREE( ctx->EvalMap.Map2Texture4.Points );
- ctx->EvalMap.Map2Texture4.Points = pnts;
+ map = &ctx->EvalMap.Map2Texture4;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
+ return;
}
- ctx->NewState |= _NEW_EVAL;
+ /* make copy of the control points */
+ if (type == GL_FLOAT)
+ pnts = gl_copy_map_points2f(target, ustride, uorder,
+ vstride, vorder, (GLfloat*) points);
+ else
+ pnts = gl_copy_map_points2d(target, ustride, uorder,
+ vstride, vorder, (GLdouble*) points);
+
+
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
+ map->Uorder = uorder;
+ map->u1 = u1;
+ map->u2 = u2;
+ map->du = 1.0 / (u2 - u1);
+ map->Vorder = vorder;
+ map->v1 = v1;
+ map->v2 = v2;
+ map->dv = 1.0 / (v2 - v1);
+ if (map->Points)
+ FREE( map->Points );
+ map->Points = pnts;
}
@@ -698,6 +478,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
GET_CURRENT_CONTEXT(ctx);
GLint i, n;
GLfloat *data;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (query) {
case GL_COEFF:
@@ -971,6 +752,7 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
GET_CURRENT_CONTEXT(ctx);
GLint i, n;
GLfloat *data;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (query) {
case GL_COEFF:
@@ -1244,6 +1026,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
GET_CURRENT_CONTEXT(ctx);
GLuint i, n;
GLfloat *data;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (query) {
case GL_COEFF:
@@ -1516,18 +1299,17 @@ void
_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid1f");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (un<1) {
gl_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" );
return;
}
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.MapGrid1un = un;
ctx->Eval.MapGrid1u1 = u1;
ctx->Eval.MapGrid1u2 = u2;
ctx->Eval.MapGrid1du = (u2 - u1) / (GLfloat) un;
-
- ctx->NewState |= _NEW_EVAL;
}
@@ -1543,7 +1325,8 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
GLint vn, GLfloat v1, GLfloat v2 )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid2f");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
if (un<1) {
gl_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" );
return;
@@ -1552,6 +1335,8 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
gl_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(vn)" );
return;
}
+
+ FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.MapGrid2un = un;
ctx->Eval.MapGrid2u1 = u1;
ctx->Eval.MapGrid2u2 = u2;
@@ -1560,8 +1345,6 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
ctx->Eval.MapGrid2v1 = v1;
ctx->Eval.MapGrid2v2 = v2;
ctx->Eval.MapGrid2dv = (v2 - v1) / (GLfloat) vn;
-
- ctx->NewState |= _NEW_EVAL;
}
diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index d9ed6a5173..4a1ebe0b97 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -1,4 +1,4 @@
-/* $Id: feedback.c,v 1.17 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: feedback.c,v 1.18 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -52,7 +52,7 @@ void
_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glFeedbackBuffer" );
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->RenderMode==GL_FEEDBACK) {
gl_error( ctx, GL_INVALID_OPERATION, "glFeedbackBuffer" );
@@ -65,45 +65,41 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
}
if (!buffer) {
gl_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(buffer==NULL)" );
- ctx->Feedback.BufferSize = 0;
+ ctx->Feedback.BufferSize = 0; /* XXX -- Sould this be here??? */
return;
}
switch (type) {
case GL_2D:
- ctx->Feedback.Mask = 0;
- ctx->Feedback.Type = type;
+ ctx->Feedback._Mask = 0;
break;
case GL_3D:
- ctx->Feedback.Mask = FB_3D;
- ctx->Feedback.Type = type;
+ ctx->Feedback._Mask = FB_3D;
break;
case GL_3D_COLOR:
- ctx->Feedback.Mask = FB_3D
- | (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX);
- ctx->Feedback.Type = type;
+ ctx->Feedback._Mask = (FB_3D |
+ (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX));
break;
case GL_3D_COLOR_TEXTURE:
- ctx->Feedback.Mask = FB_3D
- | (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX)
- | FB_TEXTURE;
- ctx->Feedback.Type = type;
+ ctx->Feedback._Mask = (FB_3D |
+ (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX) |
+ FB_TEXTURE);
break;
case GL_4D_COLOR_TEXTURE:
- ctx->Feedback.Mask = FB_3D | FB_4D
- | (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX)
- | FB_TEXTURE;
- ctx->Feedback.Type = type;
+ ctx->Feedback._Mask = (FB_3D | FB_4D |
+ (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX) |
+ FB_TEXTURE);
break;
default:
- ctx->Feedback.Mask = 0;
gl_error( ctx, GL_INVALID_ENUM, "glFeedbackBuffer" );
+ return;
}
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE); /* Always flush */
+ ctx->Feedback.Type = type;
ctx->Feedback.BufferSize = size;
ctx->Feedback.Buffer = buffer;
- ctx->Feedback.Count = 0;
- ctx->NewState |= _NEW_FEEDBACK_SELECT;
+ ctx->Feedback.Count = 0; /* Becaues of this. */
}
@@ -112,9 +108,10 @@ void
_mesa_PassThrough( GLfloat token )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPassThrough");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->RenderMode==GL_FEEDBACK) {
+ FLUSH_VERTICES(ctx, 0);
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN );
FEEDBACK_TOKEN( ctx, token );
}
@@ -133,22 +130,22 @@ void gl_feedback_vertex( GLcontext *ctx,
{
FEEDBACK_TOKEN( ctx, win[0] );
FEEDBACK_TOKEN( ctx, win[1] );
- if (ctx->Feedback.Mask & FB_3D) {
+ if (ctx->Feedback._Mask & FB_3D) {
FEEDBACK_TOKEN( ctx, win[2] );
}
- if (ctx->Feedback.Mask & FB_4D) {
+ if (ctx->Feedback._Mask & FB_4D) {
FEEDBACK_TOKEN( ctx, win[3] );
}
- if (ctx->Feedback.Mask & FB_INDEX) {
+ if (ctx->Feedback._Mask & FB_INDEX) {
FEEDBACK_TOKEN( ctx, (GLfloat) index );
}
- if (ctx->Feedback.Mask & FB_COLOR) {
+ if (ctx->Feedback._Mask & FB_COLOR) {
FEEDBACK_TOKEN( ctx, color[0] );
FEEDBACK_TOKEN( ctx, color[1] );
FEEDBACK_TOKEN( ctx, color[2] );
FEEDBACK_TOKEN( ctx, color[3] );
}
- if (ctx->Feedback.Mask & FB_TEXTURE) {
+ if (ctx->Feedback._Mask & FB_TEXTURE) {
FEEDBACK_TOKEN( ctx, texcoord[0] );
FEEDBACK_TOKEN( ctx, texcoord[1] );
FEEDBACK_TOKEN( ctx, texcoord[2] );
@@ -168,19 +165,20 @@ void
_mesa_SelectBuffer( GLsizei size, GLuint *buffer )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glSelectBuffer");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
if (ctx->RenderMode==GL_SELECT) {
gl_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" );
+ return; /* KW: added return */
}
+
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE); /* why bother? */
ctx->Select.Buffer = buffer;
ctx->Select.BufferSize = size;
ctx->Select.BufferCount = 0;
-
ctx->Select.HitFlag = GL_FALSE;
ctx->Select.HitMinZ = 1.0;
ctx->Select.HitMaxZ = 0.0;
-
- ctx->NewState |= _NEW_FEEDBACK_SELECT;
}
@@ -235,7 +233,8 @@ void
_mesa_InitNames( void )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glInitNames");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
/* Record the hit before the HitFlag is wiped out again. */
if (ctx->RenderMode == GL_SELECT) {
if (ctx->Select.HitFlag) {
@@ -246,7 +245,7 @@ _mesa_InitNames( void )
ctx->Select.HitFlag = GL_FALSE;
ctx->Select.HitMinZ = 1.0;
ctx->Select.HitMaxZ = 0.0;
- ctx->NewState |= _NEW_FEEDBACK_SELECT;
+ ctx->NewState |= _NEW_RENDERMODE;
}
@@ -255,7 +254,8 @@ void
_mesa_LoadName( GLuint name )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLoadName");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
if (ctx->RenderMode != GL_SELECT) {
return;
}
@@ -263,6 +263,9 @@ _mesa_LoadName( GLuint name )
gl_error( ctx, GL_INVALID_OPERATION, "glLoadName" );
return;
}
+
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
+
if (ctx->Select.HitFlag) {
write_hit_record( ctx );
}
@@ -272,7 +275,6 @@ _mesa_LoadName( GLuint name )
else {
ctx->Select.NameStack[MAX_NAME_STACK_DEPTH-1] = name;
}
- ctx->NewState |= _NEW_FEEDBACK_SELECT;
}
@@ -280,20 +282,21 @@ void
_mesa_PushName( GLuint name )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushName");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
if (ctx->RenderMode != GL_SELECT) {
return;
}
+
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
if (ctx->Select.HitFlag) {
write_hit_record( ctx );
}
- if (ctx->Select.NameStackDepth < MAX_NAME_STACK_DEPTH) {
- ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name;
- }
- else {
+ if (ctx->Select.NameStackDepth >= MAX_NAME_STACK_DEPTH) {
gl_error( ctx, GL_STACK_OVERFLOW, "glPushName" );
}
- ctx->NewState |= _NEW_FEEDBACK_SELECT;
+ else
+ ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name;
}
@@ -302,20 +305,21 @@ void
_mesa_PopName( void )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopName");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
if (ctx->RenderMode != GL_SELECT) {
return;
}
+
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
if (ctx->Select.HitFlag) {
write_hit_record( ctx );
}
- if (ctx->Select.NameStackDepth > 0) {
- ctx->Select.NameStackDepth--;
- }
- else {
+ if (ctx->Select.NameStackDepth == 0) {
gl_error( ctx, GL_STACK_UNDERFLOW, "glPopName" );
}
- ctx->NewState |= _NEW_FEEDBACK_SELECT;
+ else
+ ctx->Select.NameStackDepth--;
}
@@ -334,12 +338,12 @@ _mesa_RenderMode( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
GLint result;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glRenderMode", 0);
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glRenderMode %s\n", gl_lookup_enum_by_nr(mode));
+ FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
ctx->_TriangleCaps &= ~(DD_FEEDBACK|DD_SELECT);
switch (ctx->RenderMode) {
@@ -363,7 +367,6 @@ _mesa_RenderMode( GLenum mode )
ctx->Select.BufferCount = 0;
ctx->Select.Hits = 0;
ctx->Select.NameStackDepth = 0;
- ctx->NewState |= _NEW_FEEDBACK_SELECT;
break;
case GL_FEEDBACK:
if (ctx->Feedback.Count > ctx->Feedback.BufferSize) {
@@ -374,7 +377,6 @@ _mesa_RenderMode( GLenum mode )
result = ctx->Feedback.Count;
}
ctx->Feedback.Count = 0;
- ctx->NewState |= _NEW_FEEDBACK_SELECT;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glRenderMode" );
@@ -404,8 +406,6 @@ _mesa_RenderMode( GLenum mode )
}
ctx->RenderMode = mode;
- ctx->NewState |= _NEW_RENDERMODE;
-
return result;
}
diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c
index 0bf0f4824e..2a225d4d87 100644
--- a/src/mesa/main/fog.c
+++ b/src/mesa/main/fog.c
@@ -1,4 +1,4 @@
-/* $Id: fog.c,v 1.30 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: fog.c,v 1.31 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -84,39 +84,57 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
GLenum m;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFog");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (pname) {
case GL_FOG_MODE:
m = (GLenum) (GLint) *params;
- if (m==GL_LINEAR || m==GL_EXP || m==GL_EXP2) {
- ctx->Fog.Mode = m;
- }
- else {
+ if (ctx->Fog.Mode == m)
+ return;
+ switch (m) {
+ case GL_LINEAR:
+ case GL_EXP:
+ case GL_EXP2:
+ break;
+ default:
gl_error( ctx, GL_INVALID_ENUM, "glFog" );
return;
}
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.Mode = m;
break;
case GL_FOG_DENSITY:
if (*params<0.0) {
gl_error( ctx, GL_INVALID_VALUE, "glFog" );
return;
}
- else {
- ctx->Fog.Density = *params;
- }
+ if (ctx->Fog.Density == *params)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.Density = *params;
break;
case GL_FOG_START:
+ if (ctx->Fog.Start == *params)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.Start = *params;
break;
case GL_FOG_END:
+ if (ctx->Fog.End == *params)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.End = *params;
break;
case GL_FOG_INDEX:
- ctx->Fog.Index = *params;
+ if (ctx->Fog.Index == *params)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.Index = *params;
break;
case GL_FOG_COLOR:
+ if (TEST_EQ_4V(ctx->Fog.Color, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.Color[0] = params[0];
ctx->Fog.Color[1] = params[1];
ctx->Fog.Color[2] = params[2];
@@ -124,10 +142,14 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
break;
case GL_FOG_COORDINATE_SOURCE_EXT: {
GLenum p = (GLenum)(GLint) *params;
- if (p == GL_FOG_COORDINATE_EXT || p == GL_FRAGMENT_DEPTH_EXT)
- ctx->Fog.FogCoordinateSource = p;
- else
+ if (ctx->Fog.FogCoordinateSource == p)
+ return;
+ if (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT) {
gl_error( ctx, GL_INVALID_ENUM, "glFog" );
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.FogCoordinateSource = p;
break;
}
default:
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 3009773790..0a69728062 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.47 2000/12/09 20:35:32 brianp Exp $ */
+/* $Id: get.c,v 1.48 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -91,8 +91,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
GLuint texUnit = ctx->Texture.CurrentUnit;
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetBooleanv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
return;
@@ -228,18 +227,18 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = ENUM_TO_BOOL(ctx->Polygon.CullFaceMode);
break;
case GL_CURRENT_COLOR:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = INT_TO_BOOL(ctx->Current.Color[0]);
params[1] = INT_TO_BOOL(ctx->Current.Color[1]);
params[2] = INT_TO_BOOL(ctx->Current.Color[2]);
params[3] = INT_TO_BOOL(ctx->Current.Color[3]);
break;
case GL_CURRENT_INDEX:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = INT_TO_BOOL(ctx->Current.Index);
break;
case GL_CURRENT_NORMAL:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_BOOL(ctx->Current.Normal[0]);
params[1] = FLOAT_TO_BOOL(ctx->Current.Normal[1]);
params[2] = FLOAT_TO_BOOL(ctx->Current.Normal[2]);
@@ -272,7 +271,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = ctx->Current.RasterPosValid;
break;
case GL_CURRENT_TEXTURE_COORDS:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][0]);
params[1] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][1]);
params[2] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][2]);
@@ -313,7 +312,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = ENUM_TO_BOOL(ctx->Color.DrawBuffer);
break;
case GL_EDGE_FLAG:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = ctx->Current.EdgeFlag;
break;
case GL_FEEDBACK_BUFFER_SIZE:
@@ -554,10 +553,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = INT_TO_BOOL(ctx->Const.MaxClipPlanes);
break;
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
- *params = INT_TO_BOOL(VB_MAX);
+ *params = INT_TO_BOOL(ctx->Const.MaxArrayLockSize);
break;
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
- *params = INT_TO_BOOL(VB_MAX);
+ *params = INT_TO_BOOL(ctx->Const.MaxArrayLockSize);
break;
case GL_MAX_EVAL_ORDER:
*params = INT_TO_BOOL(MAX_EVAL_ORDER);
@@ -1271,7 +1270,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = ctx->Fog.ColorSumEnabled;
break;
case GL_CURRENT_SECONDARY_COLOR_EXT:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = INT_TO_BOOL(ctx->Current.SecondaryColor[0]);
params[1] = INT_TO_BOOL(ctx->Current.SecondaryColor[1]);
params[2] = INT_TO_BOOL(ctx->Current.SecondaryColor[2]);
@@ -1291,7 +1290,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
/* GL_EXT_fog_coord */
case GL_CURRENT_FOG_COORDINATE_EXT:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = FLOAT_TO_BOOL(ctx->Current.FogCoord);
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
@@ -1331,8 +1330,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
GLuint texUnit = ctx->Texture.CurrentUnit;
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetDoublev");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
return;
@@ -1467,18 +1465,18 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = ENUM_TO_DOUBLE(ctx->Polygon.CullFaceMode);
break;
case GL_CURRENT_COLOR:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]);
params[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]);
params[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]);
params[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]);
break;
case GL_CURRENT_INDEX:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = (GLdouble) ctx->Current.Index;
break;
case GL_CURRENT_NORMAL:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = (GLdouble) ctx->Current.Normal[0];
params[1] = (GLdouble) ctx->Current.Normal[1];
params[2] = (GLdouble) ctx->Current.Normal[2];
@@ -1511,7 +1509,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) ctx->Current.RasterPosValid;
break;
case GL_CURRENT_TEXTURE_COORDS:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][0];
params[1] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][1];
params[2] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][2];
@@ -1552,7 +1550,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer);
break;
case GL_EDGE_FLAG:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = (GLdouble) ctx->Current.EdgeFlag;
break;
case GL_FEEDBACK_BUFFER_SIZE:
@@ -1793,10 +1791,10 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) ctx->Const.MaxClipPlanes;
break;
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
- *params = (GLdouble) VB_MAX;
+ *params = (GLdouble) ctx->Const.MaxArrayLockSize;
break;
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
- *params = (GLdouble) VB_MAX;
+ *params = (GLdouble) ctx->Const.MaxArrayLockSize;
break;
case GL_MAX_EVAL_ORDER:
*params = (GLdouble) MAX_EVAL_ORDER;
@@ -2510,7 +2508,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) ctx->Fog.ColorSumEnabled;
break;
case GL_CURRENT_SECONDARY_COLOR_EXT:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]);
params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]);
params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]);
@@ -2530,7 +2528,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
/* GL_EXT_fog_coord */
case GL_CURRENT_FOG_COORDINATE_EXT:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = (GLdouble) ctx->Current.FogCoord;
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
@@ -2570,8 +2568,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
GLuint texUnit = ctx->Texture.CurrentUnit;
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetFloatv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
return;
@@ -2706,18 +2703,18 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode);
break;
case GL_CURRENT_COLOR:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]);
params[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]);
params[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]);
params[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]);
break;
case GL_CURRENT_INDEX:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = (GLfloat) ctx->Current.Index;
break;
case GL_CURRENT_NORMAL:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = ctx->Current.Normal[0];
params[1] = ctx->Current.Normal[1];
params[2] = ctx->Current.Normal[2];
@@ -2750,7 +2747,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) ctx->Current.RasterPosValid;
break;
case GL_CURRENT_TEXTURE_COORDS:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][0];
params[1] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][1];
params[2] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][2];
@@ -2791,7 +2788,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer);
break;
case GL_EDGE_FLAG:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = (GLfloat) ctx->Current.EdgeFlag;
break;
case GL_FEEDBACK_BUFFER_SIZE:
@@ -3032,10 +3029,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) ctx->Const.MaxClipPlanes;
break;
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
- *params = (GLfloat) VB_MAX;
+ *params = (GLfloat) ctx->Const.MaxArrayLockSize;
break;
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
- *params = (GLfloat) VB_MAX;
+ *params = (GLfloat) ctx->Const.MaxArrayLockSize;
break;
case GL_MAX_EVAL_ORDER:
*params = (GLfloat) MAX_EVAL_ORDER;
@@ -3723,7 +3720,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) ctx->Fog.ColorSumEnabled;
break;
case GL_CURRENT_SECONDARY_COLOR_EXT:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]);
params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]);
params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]);
@@ -3743,7 +3740,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
/* GL_EXT_fog_coord */
case GL_CURRENT_FOG_COORDINATE_EXT:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = (GLfloat) ctx->Current.FogCoord;
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
@@ -3783,8 +3780,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
GLuint texUnit = ctx->Texture.CurrentUnit;
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetIntegerv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
return;
@@ -3921,18 +3917,18 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) ctx->Polygon.CullFaceMode;
break;
case GL_CURRENT_COLOR:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[0] ) );
params[1] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[1] ) );
params[2] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[2] ) );
params[3] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[3] ) );
break;
case GL_CURRENT_INDEX:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = (GLint) ctx->Current.Index;
break;
case GL_CURRENT_NORMAL:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_INT( ctx->Current.Normal[0] );
params[1] = FLOAT_TO_INT( ctx->Current.Normal[1] );
params[2] = FLOAT_TO_INT( ctx->Current.Normal[2] );
@@ -3965,7 +3961,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) ctx->Current.RasterPosValid;
break;
case GL_CURRENT_TEXTURE_COORDS:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = (GLint) ctx->Current.Texcoord[texTransformUnit][0];
params[1] = (GLint) ctx->Current.Texcoord[texTransformUnit][1];
params[2] = (GLint) ctx->Current.Texcoord[texTransformUnit][2];
@@ -4006,7 +4002,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) ctx->Color.DrawBuffer;
break;
case GL_EDGE_FLAG:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = (GLint) ctx->Current.EdgeFlag;
break;
case GL_FEEDBACK_BUFFER_SIZE:
@@ -4247,10 +4243,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) ctx->Const.MaxClipPlanes;
break;
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
- *params = VB_MAX;
+ *params = (GLint) ctx->Const.MaxArrayLockSize;
break;
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
- *params = VB_MAX;
+ *params = (GLint) ctx->Const.MaxArrayLockSize;
break;
case GL_MAX_EVAL_ORDER:
*params = (GLint) MAX_EVAL_ORDER;
@@ -4965,7 +4961,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) ctx->Fog.ColorSumEnabled;
break;
case GL_CURRENT_SECONDARY_COLOR_EXT:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[0] ) );
params[1] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[1] ) );
params[2] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[2] ) );
@@ -4986,7 +4982,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
/* GL_EXT_fog_coord */
case GL_CURRENT_FOG_COORDINATE_EXT:
if (ctx->Extensions.EXT_fog_coord) {
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT(ctx, 0);
*params = (GLint) ctx->Current.FogCoord;
}
else {
@@ -5041,8 +5037,7 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint texUnit = ctx->Texture.CurrentUnit;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetPointerv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
return;
@@ -5100,8 +5095,7 @@ _mesa_GetString( GLenum name )
static const char *vendor = "Brian Paul";
static const char *renderer = "Mesa";
static const char *version = "1.2 Mesa 3.5 beta";
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGetString", 0);
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
/* this is a required driver function */
assert(ctx->Driver.GetString);
@@ -5134,10 +5128,8 @@ GLenum
_mesa_GetError( void )
{
GET_CURRENT_CONTEXT(ctx);
-
GLenum e = ctx->ErrorValue;
-
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, "glGetError", (GLenum) 0);
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glGetError <-- %s\n", gl_lookup_enum_by_nr(e));
diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c
index 577d320103..88a15ca0f7 100644
--- a/src/mesa/main/hint.c
+++ b/src/mesa/main/hint.c
@@ -1,4 +1,4 @@
-/* $Id: hint.c,v 1.5 2000/10/30 13:32:00 keithw Exp $ */
+/* $Id: hint.c,v 1.6 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -41,6 +41,7 @@ void
_mesa_Hint( GLenum target, GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
(void) _mesa_try_Hint( ctx, target, mode );
}
@@ -48,8 +49,6 @@ _mesa_Hint( GLenum target, GLenum mode )
GLboolean
_mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
{
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glHint", GL_FALSE);
-
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glHint %s %d\n", gl_lookup_enum_by_nr(target), mode);
@@ -60,24 +59,42 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
switch (target) {
case GL_FOG_HINT:
+ if (ctx->Hint.Fog == mode)
+ return GL_TRUE;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.Fog = mode;
break;
case GL_LINE_SMOOTH_HINT:
+ if (ctx->Hint.LineSmooth == mode)
+ return GL_TRUE;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.LineSmooth = mode;
break;
case GL_PERSPECTIVE_CORRECTION_HINT:
+ if (ctx->Hint.PerspectiveCorrection == mode)
+ return GL_TRUE;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.PerspectiveCorrection = mode;
break;
case GL_POINT_SMOOTH_HINT:
+ if (ctx->Hint.PointSmooth == mode)
+ return GL_TRUE;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.PointSmooth = mode;
break;
case GL_POLYGON_SMOOTH_HINT:
+ if (ctx->Hint.PolygonSmooth == mode)
+ return GL_TRUE;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.PolygonSmooth = mode;
break;
case GL_PREFER_DOUBLEBUFFER_HINT_PGI:
case GL_STRICT_DEPTHFUNC_HINT_PGI:
break;
case GL_STRICT_LIGHTING_HINT_PGI:
+ if (ctx->Hint.StrictLighting == mode)
+ return GL_TRUE;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.StrictLighting = mode;
break;
case GL_STRICT_SCISSOR_HINT_PGI:
@@ -88,6 +105,7 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
case GL_RECLAIM_MEMORY_HINT_PGI:
break;
case GL_ALWAYS_FAST_HINT_PGI:
+ FLUSH_VERTICES(ctx, _NEW_HINT);
if (mode) {
ctx->Hint.AllowDrawWin = GL_TRUE;
ctx->Hint.AllowDrawFrg = GL_FALSE;
@@ -99,6 +117,7 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
}
break;
case GL_ALWAYS_SOFT_HINT_PGI:
+ FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.AllowDrawWin = GL_TRUE;
ctx->Hint.AllowDrawFrg = GL_TRUE;
ctx->Hint.AllowDrawMem = GL_TRUE;
@@ -106,12 +125,21 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
case GL_ALLOW_DRAW_OBJ_HINT_PGI:
break;
case GL_ALLOW_DRAW_WIN_HINT_PGI:
+ if (ctx->Hint.AllowDrawWin == mode)
+ return GL_TRUE;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.AllowDrawWin = mode;
break;
case GL_ALLOW_DRAW_FRG_HINT_PGI:
+ if (ctx->Hint.AllowDrawFrg == mode)
+ return GL_TRUE;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.AllowDrawFrg = mode;
break;
case GL_ALLOW_DRAW_MEM_HINT_PGI:
+ if (ctx->Hint.AllowDrawMem == mode)
+ return GL_TRUE;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.AllowDrawMem = mode;
break;
case GL_CLIP_NEAR_HINT_PGI:
@@ -123,17 +151,22 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
/* GL_EXT_clip_volume_hint */
case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
+ if (ctx->Hint.ClipVolumeClipping == mode)
+ return GL_TRUE;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.ClipVolumeClipping = mode;
break;
/* GL_ARB_texture_compression */
case GL_TEXTURE_COMPRESSION_HINT_ARB:
if (ctx->Extensions.ARB_texture_compression) {
- ctx->Hint.TextureCompression = mode;
- }
- else {
gl_error(ctx, GL_INVALID_ENUM, "glHint(target)");
+ return GL_TRUE;
}
+ if (ctx->Hint.TextureCompression == mode)
+ return GL_TRUE;
+ FLUSH_VERTICES(ctx, _NEW_HINT);
+ ctx->Hint.TextureCompression = mode;
break;
default:
@@ -141,8 +174,6 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
return GL_FALSE;
}
- ctx->NewState |= _NEW_HINT;
-
if (ctx->Driver.Hint) {
(*ctx->Driver.Hint)( ctx, target, mode );
}
@@ -155,7 +186,7 @@ void
_mesa_HintPGI( GLenum target, GLint mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glHintPGI");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glHintPGI %s %d\n", gl_lookup_enum_by_nr(target), mode);
diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c
index ef98e51963..80ed72b6db 100644
--- a/src/mesa/main/histogram.c
+++ b/src/mesa/main/histogram.c
@@ -1,4 +1,4 @@
-/* $Id: histogram.c,v 1.4 2000/12/13 23:13:45 brianp Exp $ */
+/* $Id: histogram.c,v 1.5 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -600,7 +600,7 @@ void
_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmax");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (!ctx->Extensions.EXT_histogram) {
gl_error(ctx, GL_INVALID_OPERATION, "glGetMinmax");
@@ -617,6 +617,17 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo
return;
}
+ if (type != GL_UNSIGNED_BYTE &&
+ type != GL_BYTE &&
+ type != GL_UNSIGNED_SHORT &&
+ type != GL_SHORT &&
+ type != GL_UNSIGNED_INT &&
+ type != GL_INT &&
+ type != GL_FLOAT) {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetMinmax(type)");
+ return;
+ }
+
if (!values)
return;
@@ -644,7 +655,7 @@ void
_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogram");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (!ctx->Extensions.EXT_histogram) {
gl_error(ctx, GL_INVALID_OPERATION, "glGetHistogram");
@@ -661,6 +672,17 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G
return;
}
+ if (type != GL_UNSIGNED_BYTE &&
+ type != GL_BYTE &&
+ type != GL_UNSIGNED_SHORT &&
+ type != GL_SHORT &&
+ type != GL_UNSIGNED_INT &&
+ type != GL_INT &&
+ type != GL_FLOAT) {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(type)");
+ return;
+ }
+
if (!values)
return;
@@ -684,7 +706,7 @@ void
_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameterfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.EXT_histogram) {
gl_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv");
@@ -731,7 +753,7 @@ void
_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameteriv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.EXT_histogram) {
gl_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv");
@@ -778,7 +800,7 @@ void
_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameterfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.EXT_histogram) {
gl_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv");
@@ -804,7 +826,7 @@ void
_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameteriv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.EXT_histogram) {
gl_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv");
@@ -832,7 +854,7 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s
GLuint i;
GLboolean error = GL_FALSE;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glHistogram");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */
if (!ctx->Extensions.EXT_histogram) {
gl_error(ctx, GL_INVALID_OPERATION, "glHistogram");
@@ -913,7 +935,7 @@ void
_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMinmax");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.EXT_histogram) {
gl_error(ctx, GL_INVALID_OPERATION, "glMinmax");
@@ -929,9 +951,11 @@ _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
gl_error(ctx, GL_INVALID_ENUM, "glMinMax(internalFormat)");
return;
}
-
+
+ if (ctx->MinMax.Sink == sink)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->MinMax.Sink = sink;
- ctx->NewState |= _NEW_PIXEL;
}
@@ -940,7 +964,7 @@ _mesa_ResetHistogram(GLenum target)
{
GLuint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetHistogram");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */
if (!ctx->Extensions.EXT_histogram) {
gl_error(ctx, GL_INVALID_OPERATION, "glResetHistogram");
@@ -967,7 +991,7 @@ void
_mesa_ResetMinmax(GLenum target)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetMinmax");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (!ctx->Extensions.EXT_histogram) {
gl_error(ctx, GL_INVALID_OPERATION, "glResetMinmax");
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 4f8bdd2ce1..e1a1b96e19 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.30 2000/11/27 18:22:13 brianp Exp $ */
+/* $Id: light.c,v 1.31 2000/12/26 05:09:28 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -54,28 +54,24 @@ void
_mesa_ShadeModel( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glShadeModel");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glShadeModel %s\n", gl_lookup_enum_by_nr(mode));
- if (mode == GL_FLAT || mode == GL_SMOOTH) {
- if (ctx->Light.ShadeModel != mode) {
- ctx->Light.ShadeModel = mode;
- if (ctx->Light.ShadeModel == GL_FLAT)
- SET_BITS(ctx->_TriangleCaps, DD_FLATSHADE);
- else
- CLEAR_BITS(ctx->_TriangleCaps, DD_FLATSHADE);
-
- ctx->NewState |= _NEW_LIGHT;
-
- if (ctx->Driver.ShadeModel)
- (*ctx->Driver.ShadeModel)( ctx, mode );
- }
- }
- else {
+ if (mode != GL_FLAT && mode != GL_SMOOTH) {
gl_error( ctx, GL_INVALID_ENUM, "glShadeModel" );
+ return;
}
+
+ if (ctx->Light.ShadeModel == mode)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.ShadeModel = mode;
+ ctx->_TriangleCaps ^= DD_FLATSHADE;
+ if (ctx->Driver.ShadeModel)
+ (*ctx->Driver.ShadeModel)( ctx, mode );
}
@@ -94,92 +90,122 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
GLint i = (GLint) (light - GL_LIGHT0);
struct gl_light *l = &ctx->Light.Light[i];
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLight");
-
if (i < 0 || i >= ctx->Const.MaxLights) {
gl_error( ctx, GL_INVALID_ENUM, "glLight" );
return;
}
switch (pname) {
- case GL_AMBIENT:
- COPY_4V( l->Ambient, params );
- break;
- case GL_DIFFUSE:
- COPY_4V( l->Diffuse, params );
- break;
- case GL_SPECULAR:
- COPY_4V( l->Specular, params );
- break;
- case GL_POSITION:
- /* transform position by ModelView matrix */
- TRANSFORM_POINT( l->EyePosition, ctx->ModelView.m, params );
- if (l->EyePosition[3] != 0.0F)
- l->_Flags |= LIGHT_POSITIONAL;
- else
- l->_Flags &= ~LIGHT_POSITIONAL;
- break;
- case GL_SPOT_DIRECTION:
- /* transform direction by inverse modelview */
- if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
- _math_matrix_analyse( &ctx->ModelView );
- }
- TRANSFORM_NORMAL( l->EyeDirection, params, ctx->ModelView.inv );
- break;
- case GL_SPOT_EXPONENT:
- if (params[0]<0.0 || params[0]>128.0) {
- gl_error( ctx, GL_INVALID_VALUE, "glLight" );
- return;
- }
- if (l->SpotExponent != params[0]) {
- l->SpotExponent = params[0];
- gl_compute_spot_exp_table( l );
- }
- break;
- case GL_SPOT_CUTOFF:
- if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) {
- gl_error( ctx, GL_INVALID_VALUE, "glLight" );
- return;
- }
- l->SpotCutoff = params[0];
- l->_CosCutoff = cos(params[0]*DEG2RAD);
- if (l->_CosCutoff < 0)
- l->_CosCutoff = 0;
- if (l->SpotCutoff != 180.0F)
- l->_Flags |= LIGHT_SPOT;
- else
- l->_Flags &= ~LIGHT_SPOT;
- break;
- case GL_CONSTANT_ATTENUATION:
- if (params[0]<0.0) {
- gl_error( ctx, GL_INVALID_VALUE, "glLight" );
- return;
- }
- l->ConstantAttenuation = params[0];
- break;
- case GL_LINEAR_ATTENUATION:
- if (params[0]<0.0) {
- gl_error( ctx, GL_INVALID_VALUE, "glLight" );
- return;
- }
- l->LinearAttenuation = params[0];
- break;
- case GL_QUADRATIC_ATTENUATION:
- if (params[0]<0.0) {
- gl_error( ctx, GL_INVALID_VALUE, "glLight" );
- return;
- }
- l->QuadraticAttenuation = params[0];
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glLight" );
- return;
+ case GL_AMBIENT:
+ if (TEST_EQ_4V(l->Ambient, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ COPY_4V( l->Ambient, params );
+ break;
+ case GL_DIFFUSE:
+ if (TEST_EQ_4V(l->Diffuse, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ COPY_4V( l->Diffuse, params );
+ break;
+ case GL_SPECULAR:
+ if (TEST_EQ_4V(l->Specular, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ COPY_4V( l->Specular, params );
+ break;
+ case GL_POSITION: {
+ GLfloat tmp[4];
+ /* transform position by ModelView matrix */
+ TRANSFORM_POINT( tmp, ctx->ModelView.m, params );
+ if (TEST_EQ_4V(l->EyePosition, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ COPY_4V(l->EyePosition, tmp);
+ if (l->EyePosition[3] != 0.0F)
+ l->_Flags |= LIGHT_POSITIONAL;
+ else
+ l->_Flags &= ~LIGHT_POSITIONAL;
+ break;
+ }
+ case GL_SPOT_DIRECTION: {
+ GLfloat tmp[4];
+ /* transform direction by inverse modelview */
+ if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
+ _math_matrix_analyse( &ctx->ModelView );
+ }
+ TRANSFORM_NORMAL( tmp, params, ctx->ModelView.inv );
+ if (TEST_EQ_3V(l->EyeDirection, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ COPY_3V(l->EyeDirection, tmp);
+ break;
+ }
+ case GL_SPOT_EXPONENT:
+ if (params[0]<0.0 || params[0]>128.0) {
+ gl_error( ctx, GL_INVALID_VALUE, "glLight" );
+ return;
+ }
+ if (l->SpotExponent == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ l->SpotExponent = params[0];
+ gl_invalidate_spot_exp_table( l );
+ break;
+ case GL_SPOT_CUTOFF:
+ if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) {
+ gl_error( ctx, GL_INVALID_VALUE, "glLight" );
+ return;
+ }
+ if (l->SpotCutoff == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ l->SpotCutoff = params[0];
+ l->_CosCutoff = cos(params[0]*DEG2RAD);
+ if (l->_CosCutoff < 0)
+ l->_CosCutoff = 0;
+ if (l->SpotCutoff != 180.0F)
+ l->_Flags |= LIGHT_SPOT;
+ else
+ l->_Flags &= ~LIGHT_SPOT;
+ break;
+ case GL_CONSTANT_ATTENUATION:
+ if (params[0]<0.0) {
+ gl_error( ctx, GL_INVALID_VALUE, "glLight" );
+ return;
+ }
+ if (l->ConstantAttenuation == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ l->ConstantAttenuation = params[0];
+ break;
+ case GL_LINEAR_ATTENUATION:
+ if (params[0]<0.0) {
+ gl_error( ctx, GL_INVALID_VALUE, "glLight" );
+ return;
+ }
+ if (l->LinearAttenuation == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ l->LinearAttenuation = params[0];
+ break;
+ case GL_QUADRATIC_ATTENUATION:
+ if (params[0]<0.0) {
+ gl_error( ctx, GL_INVALID_VALUE, "glLight" );
+ return;
+ }
+ if (l->QuadraticAttenuation == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ l->QuadraticAttenuation = params[0];
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glLight" );
+ return;
}
if (ctx->Driver.Lightfv)
ctx->Driver.Lightfv( ctx, light, pname, params );
-
- ctx->NewState |= _NEW_LIGHT;
}
@@ -237,8 +263,7 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
GLint l = (GLint) (light - GL_LIGHT0);
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (l < 0 || l >= ctx->Const.MaxLights) {
gl_error( ctx, GL_INVALID_ENUM, "glGetLightfv" );
@@ -289,8 +314,7 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
GLint l = (GLint) (light - GL_LIGHT0);
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (l < 0 || l >= ctx->Const.MaxLights) {
gl_error( ctx, GL_INVALID_ENUM, "glGetLightiv" );
@@ -358,38 +382,46 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
void
_mesa_LightModelfv( GLenum pname, const GLfloat *params )
{
+ GLenum newenum;
+ GLboolean newbool;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModelfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (pname) {
case GL_LIGHT_MODEL_AMBIENT:
+ if (TEST_EQ_4V( ctx->Light.Model.Ambient, params ))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
COPY_4V( ctx->Light.Model.Ambient, params );
break;
case GL_LIGHT_MODEL_LOCAL_VIEWER:
- if (params[0]==0.0)
- ctx->Light.Model.LocalViewer = GL_FALSE;
- else
- ctx->Light.Model.LocalViewer = GL_TRUE;
+ newbool = (params[0]!=0.0);
+ if (ctx->Light.Model.LocalViewer == newbool)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Model.LocalViewer = newbool;
break;
case GL_LIGHT_MODEL_TWO_SIDE:
- if (params[0]==0.0)
- ctx->Light.Model.TwoSide = GL_FALSE;
- else
- ctx->Light.Model.TwoSide = GL_TRUE;
+ newbool = (params[0]!=0.0);
+ if (ctx->Light.Model.TwoSide == newbool)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Model.TwoSide = newbool;
break;
case GL_LIGHT_MODEL_COLOR_CONTROL:
- if (params[0] == (GLfloat) GL_SINGLE_COLOR) {
- ctx->Light.Model.ColorControl = GL_SINGLE_COLOR;
- if (!ctx->Fog.ColorSumEnabled)
- CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
- }
- else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) {
- ctx->Light.Model.ColorControl = GL_SEPARATE_SPECULAR_COLOR;
- SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
- }
- else {
+ if (params[0] == (GLfloat) GL_SINGLE_COLOR)
+ newenum = GL_SINGLE_COLOR;
+ else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR)
+ newenum = GL_SEPARATE_SPECULAR_COLOR;
+ else {
gl_error( ctx, GL_INVALID_ENUM, "glLightModel(param)" );
+ return;
}
+ if (ctx->Light.Model.ColorControl == newenum)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Model.ColorControl = newenum;
+ ctx->_TriangleCaps ^= DD_SEPERATE_SPECULAR;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glLightModel" );
@@ -398,8 +430,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
if (ctx->Driver.LightModelfv)
ctx->Driver.LightModelfv( ctx, pname, params );
-
- ctx->NewState |= _NEW_LIGHT;
}
@@ -407,8 +437,6 @@ void
_mesa_LightModeliv( GLenum pname, const GLint *params )
{
GLfloat fparam[4];
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModeliv");
switch (pname) {
case GL_LIGHT_MODEL_AMBIENT:
@@ -582,6 +610,9 @@ void gl_update_material( GLcontext *ctx,
if (bitmask & FRONT_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
COPY_4FV( mat->Diffuse, src[0].Diffuse );
+/* fprintf(stderr, "FRONT_DIFFUSE %f %f %f %f\n", */
+/* mat->Diffuse[0], mat->Diffuse[1], */
+/* mat->Diffuse[2], mat->Diffuse[3]); */
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[0], light->Diffuse, mat->Diffuse );
}
@@ -590,6 +621,9 @@ void gl_update_material( GLcontext *ctx,
if (bitmask & BACK_DIFFUSE_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
COPY_4FV( mat->Diffuse, src[1].Diffuse );
+/* fprintf(stderr, "BACK_DIFFUSE %f %f %f %f\n", */
+/* mat->Diffuse[0], mat->Diffuse[1], */
+/* mat->Diffuse[2], mat->Diffuse[3]); */
foreach (light, list) {
SCALE_3V( light->_MatDiffuse[1], light->Diffuse, mat->Diffuse );
}
@@ -613,14 +647,13 @@ void gl_update_material( GLcontext *ctx,
}
if (bitmask & FRONT_SHININESS_BIT) {
- GLfloat shininess = ctx->Light.Material[0].Shininess = src[0].Shininess;
- gl_compute_shine_table( ctx, 0, shininess );
- gl_compute_shine_table( ctx, 2, shininess * .5 );
+/* fprintf(stderr, "FRONT_SHININESS_BIT %f\n", src[0].Shininess); */
+ ctx->Light.Material[0].Shininess = src[0].Shininess;
+ gl_invalidate_shine_table( ctx, 0 );
}
if (bitmask & BACK_SHININESS_BIT) {
- GLfloat shininess = ctx->Light.Material[1].Shininess = src[1].Shininess;
- gl_compute_shine_table( ctx, 1, shininess );
- gl_compute_shine_table( ctx, 3, shininess * .5 );
+ ctx->Light.Material[1].Shininess = src[1].Shininess;
+ gl_invalidate_shine_table( ctx, 1 );
}
if (bitmask & FRONT_INDEXES_BIT) {
@@ -790,8 +823,7 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
FRONT_SPECULAR_BIT | BACK_SPECULAR_BIT |
FRONT_DIFFUSE_BIT | BACK_DIFFUSE_BIT |
FRONT_AMBIENT_BIT | BACK_AMBIENT_BIT);
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorMaterial");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glColorMaterial %s %s\n",
@@ -800,18 +832,20 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
bitmask = gl_material_bitmask( ctx, face, mode, legal, "glColorMaterial" );
- if (bitmask != 0) {
- ctx->Light.ColorMaterialBitmask = bitmask;
- ctx->Light.ColorMaterialFace = face;
- ctx->Light.ColorMaterialMode = mode;
- }
+ if (ctx->Light.ColorMaterialBitmask == bitmask &&
+ ctx->Light.ColorMaterialFace == face &&
+ ctx->Light.ColorMaterialMode == mode)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.ColorMaterialBitmask = bitmask;
+ ctx->Light.ColorMaterialFace = face;
+ ctx->Light.ColorMaterialMode = mode;
if (ctx->Light.ColorMaterialEnabled) {
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ FLUSH_CURRENT( ctx, 0 );
gl_update_color_material( ctx, ctx->Current.Color );
}
-
- ctx->NewState |= _NEW_LIGHT;
}
@@ -823,8 +857,7 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint f;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialfv");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
if (face==GL_FRONT) {
f = 0;
@@ -869,8 +902,7 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint f;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialiv");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
if (face==GL_FRONT) {
f = 0;
@@ -967,7 +999,12 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
* this function to recompute the exponent lookup table.
*/
void
-gl_compute_spot_exp_table( struct gl_light *l )
+gl_invalidate_spot_exp_table( struct gl_light *l )
+{
+ l->_SpotExpTable[0][0] = -1;
+}
+
+static void validate_spot_exp_table( struct gl_light *l )
{
GLint i;
GLdouble exponent = l->SpotExponent;
@@ -978,16 +1015,17 @@ gl_compute_spot_exp_table( struct gl_light *l )
for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) {
if (clamp == 0) {
- tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent);
- if (tmp < FLT_MIN * 100.0) {
- tmp = 0.0;
- clamp = 1;
- }
+ tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent);
+ if (tmp < FLT_MIN * 100.0) {
+ tmp = 0.0;
+ clamp = 1;
+ }
}
l->_SpotExpTable[i][0] = tmp;
}
for (i = 0; i < EXP_TABLE_SIZE - 1; i++) {
- l->_SpotExpTable[i][1] = l->_SpotExpTable[i+1][0] - l->_SpotExpTable[i][0];
+ l->_SpotExpTable[i][1] = (l->_SpotExpTable[i+1][0] -
+ l->_SpotExpTable[i][0]);
}
l->_SpotExpTable[EXP_TABLE_SIZE-1][1] = 0.0;
}
@@ -999,56 +1037,76 @@ gl_compute_spot_exp_table( struct gl_light *l )
* lighting, and the cost of doing it early may be partially offset
* by keeping a MRU cache of shine tables for various shine values.
*/
-static void
-compute_shine_table( struct gl_shine_tab *tab, GLfloat shininess )
+void
+gl_invalidate_shine_table( GLcontext *ctx, GLuint i )
{
- GLint i;
- GLfloat *m = tab->tab;
-
- m[0] = 0.0;
- if (shininess == 0.0) {
- for (i = 1 ; i <= SHINE_TABLE_SIZE ; i++)
- m[i] = 1.0;
- }
- else {
- for (i = 1 ; i < SHINE_TABLE_SIZE ; i++) {
- GLdouble t = pow(i / (GLfloat) (SHINE_TABLE_SIZE - 1), shininess);
- if (t > 1e-20)
- m[i] = t;
- else
- m[i] = 0.0;
- }
- m[SHINE_TABLE_SIZE] = 1.0;
- }
-
- tab->shininess = shininess;
+ if (ctx->_ShineTable[i])
+ ctx->_ShineTable[i]->refcount--;
+ ctx->_ShineTable[i] = 0;
}
-
-void
-gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess )
+static void validate_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess )
{
-#define DISTSQR(a,b) ((a-b)*(a-b))
struct gl_shine_tab *list = ctx->_ShineTabList;
struct gl_shine_tab *s;
+/* fprintf(stderr, "validate_shine_table %d, shininess %f\n", i, shininess); */
+
foreach(s, list)
- if ( DISTSQR(s->shininess, shininess) < 1e-4 )
+ if ( s->shininess == shininess )
break;
if (s == list) {
+ GLint i;
+ GLfloat *m;
+
foreach(s, list)
if (s->refcount == 0)
- break;
+ break;
- compute_shine_table( s, shininess );
+ m = s->tab;
+ m[0] = 0.0;
+ if (shininess == 0.0) {
+ for (i = 1 ; i <= SHINE_TABLE_SIZE ; i++)
+ m[i] = 1.0;
+ }
+ else {
+ for (i = 1 ; i < SHINE_TABLE_SIZE ; i++) {
+ GLdouble t = pow(i / (GLfloat)(SHINE_TABLE_SIZE-1), shininess);
+ if (t > 1e-20)
+ m[i] = t;
+ else
+ m[i] = 0.0;
+ }
+ m[SHINE_TABLE_SIZE] = 1.0;
+ }
+
+ s->shininess = shininess;
}
- ctx->_ShineTable[i]->refcount--;
+ if (ctx->_ShineTable[i])
+ ctx->_ShineTable[i]->refcount--;
+
ctx->_ShineTable[i] = s;
move_to_tail( list, s );
s->refcount++;
-#undef DISTSQR
+}
+
+void
+gl_validate_all_lighting_tables( GLcontext *ctx )
+{
+ GLint i;
+ GLfloat shininess;
+
+ shininess = ctx->Light.Material[0].Shininess;
+ if (!ctx->_ShineTable[0]) validate_shine_table( ctx, 0, shininess );
+
+ shininess = ctx->Light.Material[1].Shininess;
+ if (!ctx->_ShineTable[1]) validate_shine_table( ctx, 1, shininess );
+
+ for (i = 0 ; i < MAX_LIGHTS ; i++)
+ if (ctx->Light.Light[i]._SpotExpTable[0][0] == -1)
+ validate_spot_exp_table( &ctx->Light.Light[i] );
}
@@ -1064,7 +1122,7 @@ void
gl_update_lighting( GLcontext *ctx )
{
struct gl_light *light;
- ctx->_TriangleCaps &= ~(DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL);
+ ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT;
ctx->_NeedNormals &= ~NEED_NORMALS_LIGHT;
ctx->Light._Flags = 0;
@@ -1075,7 +1133,7 @@ gl_update_lighting( GLcontext *ctx )
ctx->_NeedNormals |= NEED_NORMALS_LIGHT;
if (ctx->Light.Model.TwoSide)
- ctx->_TriangleCaps |= (DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL);
+ ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
foreach(light, &ctx->Light.EnabledList) {
ctx->Light._Flags |= light->_Flags;
@@ -1099,7 +1157,10 @@ gl_update_lighting( GLcontext *ctx )
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT;
- /* Precompute some shading values.
+ /* Precompute some shading values. Although we reference
+ * Light.Material here, we can get away without flushing
+ * FLUSH_UPDATE_CURRENT, as when any outstanding material changes
+ * are flushed, they will update the derived state at that time.
*/
if (ctx->Visual.RGBAflag) {
GLuint sides = ctx->Light.Model.TwoSide ? 2 : 1;
diff --git a/src/mesa/main/light.h b/src/mesa/main/light.h
index 604e4d5806..f737abf4e4 100644
--- a/src/mesa/main/light.h
+++ b/src/mesa/main/light.h
@@ -1,4 +1,4 @@
-/* $Id: light.h,v 1.7 2000/11/24 10:25:05 keithw Exp $ */
+/* $Id: light.h,v 1.8 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -101,10 +101,11 @@ extern GLuint gl_material_bitmask( GLcontext *ctx,
extern void gl_set_material( GLcontext *ctx, GLuint bitmask,
const GLfloat *params);
-extern void gl_compute_spot_exp_table( struct gl_light *l );
-extern void gl_compute_shine_table( GLcontext *ctx, GLuint i,
- GLfloat shininess );
+extern void gl_invalidate_spot_exp_table( struct gl_light *l );
+extern void gl_invalidate_shine_table( GLcontext *ctx, GLuint i );
+extern void gl_validate_all_lighting_tables( GLcontext *ctx );
+
extern void gl_update_lighting( GLcontext *ctx );
diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c
index e23d8a4de2..c54f108b23 100644
--- a/src/mesa/main/lines.c
+++ b/src/mesa/main/lines.c
@@ -1,4 +1,4 @@
-/* $Id: lines.c,v 1.23 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: lines.c,v 1.24 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -45,22 +45,26 @@ void
_mesa_LineWidth( GLfloat width )
{
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
if (width<=0.0) {
gl_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
return;
}
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineWidth");
- if (ctx->Line.Width != width) {
- ctx->Line.Width = width;
- ctx->_TriangleCaps &= ~DD_LINE_WIDTH;
- if (width != 1.0) ctx->_TriangleCaps |= DD_LINE_WIDTH;
+ if (ctx->Line.Width == width)
+ return;
- ctx->NewState |= _NEW_LINE;
+ FLUSH_VERTICES(ctx, _NEW_LINE);
+ ctx->Line.Width = width;
- if (ctx->Driver.LineWidth)
- (*ctx->Driver.LineWidth)(ctx, width);
- }
+ if (width != 1.0)
+ ctx->_TriangleCaps |= DD_LINE_WIDTH;
+ else
+ ctx->_TriangleCaps &= ~DD_LINE_WIDTH;
+
+ if (ctx->Driver.LineWidth)
+ (*ctx->Driver.LineWidth)(ctx, width);
}
@@ -69,12 +73,16 @@ void
_mesa_LineStipple( GLint factor, GLushort pattern )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineStipple");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Line.StippleFactor == CLAMP( factor, 1, 256 ) &&
+ ctx->Line.StipplePattern == pattern)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_LINE);
ctx->Line.StippleFactor = CLAMP( factor, 1, 256 );
ctx->Line.StipplePattern = pattern;
- ctx->NewState |= _NEW_LINE;
-
if (ctx->Driver.LineStipple)
ctx->Driver.LineStipple( ctx, factor, pattern );
}
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 02121e3e12..a77e2fc65b 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -1,4 +1,4 @@
-/* $Id: macros.h,v 1.15 2000/11/24 10:25:05 keithw Exp $ */
+/* $Id: macros.h,v 1.16 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -72,6 +72,7 @@
*/
#define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i))
#define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i))
+#define STRIDE_4UB(p, i) (p = (GLubyte (*)[4])((GLubyte *)p + i))
#define STRIDE_T(p, t, i) (p = (t *)((GLubyte *)p + i))
@@ -80,6 +81,23 @@
#define ZERO_4V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = (DST)[3] = 0
+#define TEST_EQ_4V(a,b) ((a)[0] == (b)[0] && \
+ (a)[1] == (b)[1] && \
+ (a)[2] == (b)[2] && \
+ (a)[3] == (b)[3])
+
+#define TEST_EQ_3V(a,b) ((a)[0] == (b)[0] && \
+ (a)[1] == (b)[1] && \
+ (a)[2] == (b)[2])
+
+#if defined(__i386__)
+#define TEST_EQ_4UBV(DST, SRC) *((GLuint*)(DST)) == *((GLuint*)(SRC))
+#else
+#define TEST_EQ_4UBV(DST, SRC) TEST_EQ_4V(DST, SRC)
+#endif
+
+
+
/* Copy short vectors: */
#define COPY_2V( DST, SRC ) \
do { \
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index 6106a80aff..2cd471f4e2 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -1,4 +1,4 @@
-/* $Id: matrix.c,v 1.28 2000/11/24 10:25:05 keithw Exp $ */
+/* $Id: matrix.c,v 1.29 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -59,7 +59,6 @@
#define GET_ACTIVE_MATRIX(ctx, mat, flags, where) \
do { \
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, where); \
if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "%s\n", where); \
switch (ctx->Transform.MatrixMode) { \
case GL_MODELVIEW: \
@@ -91,6 +90,7 @@ _mesa_Frustum( GLdouble left, GLdouble right,
{
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glFrustrum" );
@@ -115,6 +115,7 @@ _mesa_Ortho( GLdouble left, GLdouble right,
{
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glOrtho" );
@@ -134,13 +135,17 @@ void
_mesa_MatrixMode( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMatrixMode");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
switch (mode) {
case GL_MODELVIEW:
case GL_PROJECTION:
case GL_TEXTURE:
case GL_COLOR:
+ if (ctx->Transform.MatrixMode == mode)
+ return;
ctx->Transform.MatrixMode = mode;
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glMatrixMode" );
@@ -153,7 +158,7 @@ void
_mesa_PushMatrix( void )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushMatrix");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glPushMatrix %s\n",
@@ -206,7 +211,7 @@ void
_mesa_PopMatrix( void )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopMatrix");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glPopMatrix %s\n",
@@ -265,6 +270,7 @@ _mesa_LoadIdentity( void )
{
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadIdentity");
_math_matrix_set_identity( mat );
}
@@ -275,6 +281,7 @@ _mesa_LoadMatrixf( const GLfloat *m )
{
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadMatrix");
_math_matrix_loadf( mat, m );
}
@@ -300,6 +307,7 @@ _mesa_MultMatrixf( const GLfloat *m )
{
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glMultMatrix" );
_math_matrix_mul_floats( mat, m );
}
@@ -328,6 +336,7 @@ void
_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (angle != 0.0F) {
GLmatrix *mat = 0;
GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glRotate" );
@@ -350,6 +359,7 @@ _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glScale");
_math_matrix_scale( mat, x, y, z );
}
@@ -370,6 +380,7 @@ _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glTranslate");
_math_matrix_translate( mat, x, y, z );
}
@@ -425,6 +436,7 @@ void
_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
{
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
gl_Viewport(ctx, x, y, width, height);
}
@@ -441,8 +453,6 @@ _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
void
gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height )
{
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glViewport");
-
if (width<0 || height<0) {
gl_error( ctx, GL_INVALID_VALUE, "glViewport" );
return;
@@ -461,7 +471,9 @@ gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height )
ctx->Viewport.Y = y;
ctx->Viewport.Height = height;
- /* compute scale and bias values */
+ /* compute scale and bias values :: This is really driver-specific
+ * and should be maintained elsewhere if at all.
+ */
ctx->Viewport._WindowMap.m[MAT_SX] = (GLfloat) width / 2.0F;
ctx->Viewport._WindowMap.m[MAT_TX] = ctx->Viewport._WindowMap.m[MAT_SX] + x;
ctx->Viewport._WindowMap.m[MAT_SY] = (GLfloat) height / 2.0F;
@@ -500,7 +512,7 @@ _mesa_DepthRange( GLclampd nearval, GLclampd farval )
*/
GLfloat n, f;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthRange");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glDepthRange %f %f\n", nearval, farval);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c6b4ac9180..3a7c6b3882 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.6 2000/12/14 20:25:56 brianp Exp $ */
+/* $Id: mtypes.h,v 1.7 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -101,6 +101,11 @@
#endif
+/* Maximum number of temporary vertices required for clipping. (Used
+ * in array_cache and tnl modules).
+ */
+#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
+
/*
* Depth buffer data type:
*/
@@ -220,10 +225,6 @@ struct gl_lightmodel {
};
-/* Move to using pointers to this struct in the immediate structs -
- * this is too big to keep 94 unused copies (7K) lying around in
- * display lists.
- */
struct gl_material
{
GLfloat Ambient[4];
@@ -237,15 +238,11 @@ struct gl_material
};
-
-
-
/*
* Attribute structures:
* We define a struct for each attribute group to make pushing and
* popping attributes easy. Also it's a good organization.
*/
-
struct gl_accum_attrib {
GLfloat ClearColor[4]; /* Accumulation buffer clear color */
};
@@ -296,8 +293,7 @@ struct gl_colorbuffer_attrib {
struct gl_current_attrib {
- /* These values valid only when FLUSH_TNL( FLUSH_UPDATE_CURRENT )
- * has been called.
+ /* These values valid only when FLUSH_VERTICES has been called.
*/
GLfloat Normal[3]; /* Current vertex normal */
GLchan Color[4]; /* Current RGBA color */
@@ -480,7 +476,11 @@ struct gl_convolution_attrib {
struct gl_light_attrib {
struct gl_light Light[MAX_LIGHTS]; /* Array of lights */
struct gl_lightmodel Model; /* Lighting model */
+
+ /* Must flush FLUSH_VERTICES before referencing:
+ */
struct gl_material Material[2]; /* Material 0=front, 1=back */
+
GLboolean Enabled; /* Lighting enabled flag */
GLenum ShadeModel; /* GL_FLAT or GL_SMOOTH */
GLenum ColorMaterialFace; /* GL_FRONT, BACK or FRONT_AND_BACK */
@@ -492,7 +492,7 @@ struct gl_light_attrib {
/* Derived for optimizations: */
GLboolean _NeedVertices; /* Use fast shader? */
- GLuint _Flags; /* State, see below */
+ GLuint _Flags; /* LIGHT_* flags, see below */
GLfloat _BaseColor[2][3];
GLchan _BaseAlpha[2];
};
@@ -616,10 +616,8 @@ struct gl_polygon_attrib {
GLenum FrontFace; /* Either GL_CW or GL_CCW */
GLenum FrontMode; /* Either GL_POINT, GL_LINE or GL_FILL */
GLenum BackMode; /* Either GL_POINT, GL_LINE or GL_FILL */
- GLboolean FrontBit; /* */
- GLboolean _Unfilled; /* True if back or front mode is not GL_FILL */
+ GLboolean _FrontBit; /* */
GLboolean CullFlag; /* Culling on/off flag */
- GLubyte _CullBits; /* Used for cull testing */
GLboolean SmoothFlag; /* True if GL_POLYGON_SMOOTH is enabled */
GLboolean StippleFlag; /* True if GL_POLYGON_STIPPLE is enabled */
GLenum CullFaceMode; /* Culling mode GL_FRONT or GL_BACK */
@@ -680,6 +678,26 @@ struct gl_stencil_attrib {
#define TEXTURE3_3D (TEXTURE0_3D << 12)
#define TEXTURE3_CUBE (TEXTURE0_CUBE << 12)
#define TEXTURE3_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
+#define TEXTURE4_1D (TEXTURE0_1D << 16) /* Texture unit 3 */
+#define TEXTURE4_2D (TEXTURE0_2D << 16)
+#define TEXTURE4_3D (TEXTURE0_3D << 16)
+#define TEXTURE4_CUBE (TEXTURE0_CUBE << 16)
+#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
+#define TEXTURE5_1D (TEXTURE0_1D << 20) /* Texture unit 3 */
+#define TEXTURE5_2D (TEXTURE0_2D << 20)
+#define TEXTURE5_3D (TEXTURE0_3D << 20)
+#define TEXTURE5_CUBE (TEXTURE0_CUBE << 20)
+#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
+#define TEXTURE6_1D (TEXTURE0_1D << 24) /* Texture unit 3 */
+#define TEXTURE6_2D (TEXTURE0_2D << 24)
+#define TEXTURE6_3D (TEXTURE0_3D << 24)
+#define TEXTURE6_CUBE (TEXTURE0_CUBE << 24)
+#define TEXTURE6_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
+#define TEXTURE7_1D (TEXTURE0_1D << 28) /* Texture unit 3 */
+#define TEXTURE7_2D (TEXTURE0_2D << 28)
+#define TEXTURE7_3D (TEXTURE0_3D << 28)
+#define TEXTURE7_CUBE (TEXTURE0_CUBE << 28)
+#define TEXTURE7_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
/* Bitmap versions of the GL_ constants.
*/
@@ -708,33 +726,42 @@ struct gl_stencil_attrib {
/* A selection of state flags to make driver and module's lives easier.
*/
-#define ENABLE_TEX0 0x000f /* TEXTURE0_ANY */
-#define ENABLE_TEX1 0x00f0 /* TEXTURE1_ANY */
-#define ENABLE_TEX2 0x0f00 /* TEXTURE2_ANY */
-#define ENABLE_TEX3 0xf000 /* TEXTURE3_ANY */
-#define ENABLE_TEXGEN0 0x10000
-#define ENABLE_TEXGEN1 0x20000
-#define ENABLE_TEXGEN2 0x40000
-#define ENABLE_TEXGEN3 0x80000
-#define ENABLE_TEXMAT0 0x100000 /* Ie. not the identity matrix */
-#define ENABLE_TEXMAT1 0x200000
-#define ENABLE_TEXMAT2 0x400000
-#define ENABLE_TEXMAT3 0x800000
-#define ENABLE_LIGHT 0x1000000
-#define ENABLE_FOG 0x2000000
-#define ENABLE_USERCLIP 0x4000000
-#define ENABLE_NORMALIZE 0x10000000
-#define ENABLE_RESCALE 0x20000000
-#define ENABLE_POINT_ATTEN 0x40000000
-
-
-#define ENABLE_TEX_ANY (ENABLE_TEX0 | ENABLE_TEX1 | \
- ENABLE_TEX2 | ENABLE_TEX3)
+#define ENABLE_TEXGEN0 0x1
+#define ENABLE_TEXGEN1 0x2
+#define ENABLE_TEXGEN2 0x4
+#define ENABLE_TEXGEN3 0x8
+#define ENABLE_TEXGEN4 0x10
+#define ENABLE_TEXGEN5 0x20
+#define ENABLE_TEXGEN6 0x40
+#define ENABLE_TEXGEN7 0x80
+#define ENABLE_TEXMAT0 0x100 /* Ie. not the identity matrix */
+#define ENABLE_TEXMAT1 0x200
+#define ENABLE_TEXMAT2 0x400
+#define ENABLE_TEXMAT3 0x800
+#define ENABLE_TEXMAT4 0x1000
+#define ENABLE_TEXMAT5 0x2000
+#define ENABLE_TEXMAT6 0x4000
+#define ENABLE_TEXMAT7 0x8000
+#define ENABLE_LIGHT 0x10000
+#define ENABLE_FOG 0x20000
+#define ENABLE_USERCLIP 0x40000
+#define ENABLE_NORMALIZE 0x100000
+#define ENABLE_RESCALE 0x200000
+#define ENABLE_POINT_ATTEN 0x400000
+
+
#define ENABLE_TEXGEN_ANY (ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | \
- ENABLE_TEXGEN2 | ENABLE_TEXGEN3)
+ ENABLE_TEXGEN2 | ENABLE_TEXGEN3 | \
+ ENABLE_TEXGEN4 | ENABLE_TEXGEN5 | \
+ ENABLE_TEXGEN6 | ENABLE_TEXGEN7)
+
#define ENABLE_TEXMAT_ANY (ENABLE_TEXMAT0 | ENABLE_TEXMAT1 | \
- ENABLE_TEXMAT2 | ENABLE_TEXMAT3)
+ ENABLE_TEXMAT2 | ENABLE_TEXMAT3 | \
+ ENABLE_TEXMAT4 | ENABLE_TEXMAT5 | \
+ ENABLE_TEXMAT6 | ENABLE_TEXMAT7)
+#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
+#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
/* Texture image record */
struct gl_texture_image {
@@ -889,9 +916,6 @@ struct gl_texture_attrib {
};
-
-/* KW: Renamed ClipEquation to avoid having 'ClipClipEquation'
- */
struct gl_transform_attrib {
GLenum MatrixMode; /* Matrix mode */
GLfloat EyeUserPlane[MAX_CLIP_PLANES][4];
@@ -960,20 +984,13 @@ struct gl_array_attrib {
struct gl_client_array TexCoord[MAX_TEXTURE_UNITS];
struct gl_client_array EdgeFlag;
- trans_4f_func _VertexFunc; /* conversion functions */
- trans_3f_func _NormalFunc;
- trans_4ub_func _ColorFunc;
- trans_1ui_func _IndexFunc;
- trans_1f_func _FogCoordFunc;
- trans_4ub_func _SecondaryColorFunc;
- trans_4f_func _TexCoordFunc[MAX_TEXTURE_UNITS];
- trans_1ub_func _EdgeFlagFunc;
-
GLint TexCoordInterleaveFactor;
GLint ActiveTexture; /* Client Active Texture */
-
GLuint LockFirst;
GLuint LockCount;
+
+ GLuint _Enabled; /* _NEW_ARRAY_* - bit set if array enabled */
+ GLuint NewState; /* _NEW_ARRAY_* */
};
@@ -981,7 +998,7 @@ struct gl_array_attrib {
struct gl_feedback {
GLenum Type;
- GLuint Mask;
+ GLuint _Mask; /* FB_* bits */
GLfloat *Buffer;
GLuint BufferSize;
GLuint Count;
@@ -1260,7 +1277,7 @@ struct gl_extensions {
/*
- * Bits to indicate what state has changed.
+ * Bits to indicate what state has changed. 6 unused flags.
*/
#define _NEW_MODELVIEW 0x1 /* ctx->ModelView */
#define _NEW_PROJECTION 0x2 /* ctx->Projection */
@@ -1272,11 +1289,11 @@ struct gl_extensions {
#define _NEW_EVAL 0x80 /* ctx->Eval, ctx->EvalMap */
#define _NEW_FOG 0x100 /* ctx->Fog */
#define _NEW_HINT 0x200 /* ctx->Hint */
-#define _NEW_400 0x400 /* unused */
+#define _NEW_400 0x400 /* */
#define _NEW_LIGHT 0x800 /* ctx->Light */
-#define _NEW_1000 0x1000 /* unused */
+#define _NEW_1000 0x1000 /* */
#define _NEW_LINE 0x2000 /* ctx->Line */
-#define _NEW_FEEDBACK_SELECT 0x4000 /* ctx->Feedback, ctx->Select */
+#define _NEW_4000 0x4000 /* */
#define _NEW_PIXEL 0x8000 /* ctx->Pixel */
#define _NEW_POINT 0x10000 /* ctx->Point */
#define _NEW_POLYGON 0x20000 /* ctx->Polygon */
@@ -1289,36 +1306,53 @@ struct gl_extensions {
#define _NEW_PACKUNPACK 0x1000000 /* ctx->Pack, ctx->Unpack */
#define _NEW_ARRAY 0x2000000 /* ctx->Array */
#define _NEW_COLORTABLE 0x4000000 /* ctx->{*}ColorTable */
-#define _NEW_RENDERMODE 0x8000000 /* ctx->RenderMode */
+#define _NEW_RENDERMODE 0x8000000 /* RenderMode, Feedback, Select */
#define _NEW_BUFFERS 0x10000000 /* ctx->Visual, ctx->DrawBuffer, */
#define _NEW_ALL ~0
-/* What can the driver do, what requires us to call render_triangle or
- * a non-driver rasterize function?
+/* Bits to track array state changes (also used to summarize array enabled)
+ */
+#define _NEW_ARRAY_VERTEX 0x1
+#define _NEW_ARRAY_COLOR 0x2
+#define _NEW_ARRAY_NORMAL 0x4
+#define _NEW_ARRAY_INDEX 0x8
+#define _NEW_ARRAY_EDGEFLAG 0x10
+#define _NEW_ARRAY_SECONDARYCOLOR 0x20
+#define _NEW_ARRAY_FOGCOORD 0x40
+#define _NEW_ARRAY_TEXCOORD_0 0x80
+#define _NEW_ARRAY_TEXCOORD_1 0x100
+#define _NEW_ARRAY_TEXCOORD_2 0x200
+#define _NEW_ARRAY_TEXCOORD_3 0x400
+#define _NEW_ARRAY_TEXCOORD_4 0x800
+#define _NEW_ARRAY_TEXCOORD_5 0x1000
+#define _NEW_ARRAY_TEXCOORD_6 0x2000
+#define _NEW_ARRAY_TEXCOORD_7 0x4000
+#define _NEW_ARRAY_ALL 0x7fff
+
+#define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0<<(i))
+
+/* A bunch of flags that we think might be useful to drivers.
*/
#define DD_FEEDBACK 0x1
#define DD_SELECT 0x2
#define DD_FLATSHADE 0x4
-#define DD_MULTIDRAW 0x8
#define DD_SEPERATE_SPECULAR 0x10
#define DD_TRI_LIGHT_TWOSIDE 0x20
#define DD_TRI_UNFILLED 0x40
#define DD_TRI_SMOOTH 0x80
#define DD_TRI_STIPPLE 0x100
#define DD_TRI_OFFSET 0x200
-#define DD_TRI_CULL 0x400
#define DD_LINE_SMOOTH 0x800
#define DD_LINE_STIPPLE 0x1000
#define DD_LINE_WIDTH 0x2000
#define DD_POINT_SMOOTH 0x4000
#define DD_POINT_SIZE 0x8000
#define DD_POINT_ATTEN 0x10000
-#define DD_LIGHTING_CULL 0x20000
-#define DD_TRI_CULL_FRONT_BACK 0x400000 /* not supported by most drivers */
-#define DD_Z_NEVER 0x800000
+#define DD_TRI_CULL_FRONT_BACK 0x400000 /* special case on some hw */
+#define DD_Z_NEVER 0x800000 /* special case on some hw */
#define DD_STENCIL 0x1000000
/* Define the state changes under which each of these bits might change
@@ -1333,7 +1367,6 @@ struct gl_extensions {
#define _DD_NEW_TRI_SMOOTH _NEW_POLYGON
#define _DD_NEW_TRI_STIPPLE _NEW_POLYGON
#define _DD_NEW_TRI_OFFSET _NEW_POLYGON
-#define _DD_NEW_TRI_CULL _NEW_POLYGON
#define _DD_NEW_LINE_SMOOTH _NEW_LINE
#define _DD_NEW_LINE_STIPPLE _NEW_LINE
#define _DD_NEW_LINE_WIDTH _NEW_LINE
@@ -1345,25 +1378,17 @@ struct gl_extensions {
#define _DD_NEW_Z_NEVER _NEW_DEPTH
#define _DD_NEW_STENCIL _NEW_STENCIL
-#define _TNL_NEW_RENDERFLAGS (_NEW_TEXTURE | \
- _DD_NEW_SEPERATE_SPECULAR | \
- _NEW_POLYGON | \
- _NEW_FOG | \
- _NEW_RENDERMODE)
-#define _TNL_NEW_NEED_EYE_COORDS (_NEW_LIGHT| \
- _NEW_TEXTURE| \
- _NEW_POINT| \
- _NEW_MODELVIEW)
-
-#define _TNL_NEW_NEED_NORMALS (_NEW_LIGHT| \
- _NEW_TEXTURE)
+#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT| \
+ _NEW_TEXTURE| \
+ _NEW_POINT| \
+ _NEW_MODELVIEW)
+
+#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT| \
+ _NEW_TEXTURE)
-#define _TNL_NEW_NORMAL_TRANSFORM (_NEW_MODELVIEW|_NEW_TRANSFORM| \
- _TNL_NEW_NEED_NORMALS)
+#define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL|_NEW_COLOR_MATRIX)
-#define _TNL_NEW_SPACES (_TNL_NEW_NEED_NORMALS | \
- _TNL_NEW_NEED_EYE_COORDS )
#define NEED_NORMALS_TEXGEN 0x1
#define NEED_NORMALS_LIGHT 0x2
@@ -1375,15 +1400,6 @@ struct gl_extensions {
-#define DD_ANY_CULL (DD_TRI_CULL_FRONT_BACK| \
- DD_TRI_CULL| \
- DD_LIGHTING_CULL)
-
-
-
-
-
-
/*
* Forward declaration of display list datatypes:
*/
@@ -1534,7 +1550,7 @@ struct __GLcontextRec {
GLuint _NeedEyeCoords;
GLuint _NeedNormals; /* Are vertex normal vectors needed? */
- struct gl_shine_tab *_ShineTable[4]; /* Active shine tables */
+ struct gl_shine_tab *_ShineTable[2]; /* Active shine tables */
struct gl_shine_tab *_ShineTabList; /* Mru list of inactive shine tables */
struct gl_list_extensions listext; /* driver dlist extensions */
@@ -1568,13 +1584,14 @@ struct __GLcontextRec {
void *swrast_context;
void *swsetup_context;
void *swtnl_context;
- void *swtnl_vb;
void *swtnl_im;
+ void *acache_context;
+ void *aelt_context;
};
/* The string names for GL_POINT, GL_LINE_LOOP, etc */
-extern const char *_mesa_prim_name[GL_POLYGON+2];
+extern const char *_mesa_prim_name[GL_POLYGON+4];
extern GLenum gl_reduce_prim[];
@@ -1598,8 +1615,6 @@ enum _verbose {
VERBOSE_DRIVER = 0x10,
VERBOSE_STATE = 0x20,
VERBOSE_API = 0x40,
- VERBOSE_TRIANGLE_CHECKS = 0x80,
- VERBOSE_CULL = 0x100,
VERBOSE_DISPLAY_LIST = 0x200,
VERBOSE_LIGHTING = 0x400
};
@@ -1614,50 +1629,45 @@ enum _debug {
#define Elements(x) sizeof(x)/sizeof(*(x))
-#define FLUSH_TNL( ctx, flags ) \
-do { \
- if (ctx->Driver.NeedFlush & flags) \
- ctx->Driver.FlushVertices( ctx, flags ); \
-} while (0)
-#define FLUSH_TNL_RETURN( ctx, flags, where ) \
+/* Eventually let the driver specify what statechanges require a flush:
+ */
+#define FLUSH_VERTICES(ctx, newstate) \
do { \
- if (ctx->Driver.NeedFlush & flags) { \
- if (!ctx->Driver.FlushVertices( ctx, flags )) { \
- gl_error( ctx, GL_INVALID_OPERATION, where ); \
- return; \
- } \
- } \
+ if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
+ ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
+ ctx->NewState |= newstate; \
} while (0)
-#define FLUSH_TNL_RETVAL( ctx, flags, where, what ) \
+#define FLUSH_CURRENT(ctx, newstate) \
do { \
- if (ctx->Driver.NeedFlush & flags) { \
- if (!ctx->Driver.FlushVertices( ctx, flags )) { \
- gl_error( ctx, GL_INVALID_OPERATION, where ); \
- return what; \
- } \
- } \
+ if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
+ ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
+ ctx->NewState |= newstate; \
} while (0)
+#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \
+do { \
+ if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { \
+ gl_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
+ return retval; \
+ } \
+} while (0); FLUSH_VERTICES(ctx, 0)
-#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, where, what ) \
- FLUSH_TNL_RETVAL( ctx, \
- (FLUSH_INSIDE_BEGIN_END| \
- FLUSH_STORED_VERTICES), \
- where, what )
+#define ASSERT_OUTSIDE_BEGIN_END(ctx) \
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx,); FLUSH_VERTICES(ctx, 0)
-#define ASSERT_OUTSIDE_BEGIN_END( ctx, where ) \
- FLUSH_TNL_RETURN( ctx, \
- (FLUSH_INSIDE_BEGIN_END| \
- FLUSH_STORED_VERTICES), \
- where )
+#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \
+do { \
+ ASSERT_OUTSIDE_BEGIN_END(ctx); \
+ FLUSH_VERTICES(ctx, 0); \
+} while (0)
-#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, where ) \
- ASSERT_OUTSIDE_BEGIN_END( ctx, where );
-
-#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL( ctx, where, what ) \
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, where, what );
+#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
+do { \
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \
+ FLUSH_VERTICES(ctx, 0); \
+} while (0)
#ifdef DEBUG
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index cb0818c084..6bbbbdfe3e 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -1,4 +1,4 @@
-/* $Id: pixel.c,v 1.21 2000/12/13 00:46:21 brianp Exp $ */
+/* $Id: pixel.c,v 1.22 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -49,11 +49,14 @@ void
_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelZoom");
+ if (ctx->Pixel.ZoomX == xfactor &&
+ ctx->Pixel.ZoomY == yfactor)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.ZoomX = xfactor;
ctx->Pixel.ZoomY = yfactor;
- ctx->NewState |= _NEW_PIXEL;
}
@@ -68,118 +71,162 @@ _mesa_PixelStorei( GLenum pname, GLint param )
{
/* NOTE: this call can't be compiled into the display list */
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelStore");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (pname) {
case GL_PACK_SWAP_BYTES:
+ if (param == (GLint)ctx->Pack.SwapBytes)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
break;
case GL_PACK_LSB_FIRST:
+ if (param == (GLint)ctx->Pack.LsbFirst)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
break;
case GL_PACK_ROW_LENGTH:
if (param<0) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
}
- else {
- ctx->Pack.RowLength = param;
- }
+ if (ctx->Pack.RowLength == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.RowLength = param;
break;
case GL_PACK_IMAGE_HEIGHT:
- if (param<0)
+ if (param<0) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- else
- ctx->Pack.ImageHeight = param;
+ return;
+ }
+ if (ctx->Pack.ImageHeight == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.ImageHeight = param;
break;
case GL_PACK_SKIP_PIXELS:
if (param<0) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
}
- else {
- ctx->Pack.SkipPixels = param;
- }
+ if (ctx->Pack.SkipPixels == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.SkipPixels = param;
break;
case GL_PACK_SKIP_ROWS:
if (param<0) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
}
- else {
- ctx->Pack.SkipRows = param;
- }
+ if (ctx->Pack.SkipRows == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.SkipRows = param;
break;
case GL_PACK_SKIP_IMAGES:
if (param<0) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
}
- else {
- ctx->Pack.SkipImages = param;
- }
+ if (ctx->Pack.SkipImages == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.SkipImages = param;
break;
case GL_PACK_ALIGNMENT:
- if (param==1 || param==2 || param==4 || param==8) {
- ctx->Pack.Alignment = param;
- }
- else {
+ if (param!=1 && param!=2 && param!=4 && param!=8) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
}
+ if (ctx->Pack.Alignment == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.Alignment = param;
break;
case GL_UNPACK_SWAP_BYTES:
+ if (param == (GLint)ctx->Unpack.SwapBytes)
+ return;
+ if ((GLint)ctx->Unpack.SwapBytes == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
break;
case GL_UNPACK_LSB_FIRST:
+ if (param == (GLint)ctx->Unpack.LsbFirst)
+ return;
+ if ((GLint)ctx->Unpack.LsbFirst == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
break;
case GL_UNPACK_ROW_LENGTH:
if (param<0) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
}
- else {
- ctx->Unpack.RowLength = param;
- }
+ if (ctx->Unpack.RowLength == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.RowLength = param;
break;
case GL_UNPACK_IMAGE_HEIGHT:
- if (param<0)
+ if (param<0) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- else
- ctx->Unpack.ImageHeight = param;
+ return;
+ }
+ if (ctx->Unpack.ImageHeight == param)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.ImageHeight = param;
break;
case GL_UNPACK_SKIP_PIXELS:
if (param<0) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
}
- else {
- ctx->Unpack.SkipPixels = param;
- }
+ if (ctx->Unpack.SkipPixels == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.SkipPixels = param;
break;
case GL_UNPACK_SKIP_ROWS:
if (param<0) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
}
- else {
- ctx->Unpack.SkipRows = param;
- }
+ if (ctx->Unpack.SkipRows == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.SkipRows = param;
break;
case GL_UNPACK_SKIP_IMAGES:
if (param < 0) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
}
- else {
- ctx->Unpack.SkipImages = param;
- }
+ if (ctx->Unpack.SkipImages == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.SkipImages = param;
break;
case GL_UNPACK_ALIGNMENT:
- if (param==1 || param==2 || param==4 || param==8) {
- ctx->Unpack.Alignment = param;
- }
- else {
+ if (param!=1 && param!=2 && param!=4 && param!=8) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore" );
+ return;
}
+ if (ctx->Unpack.Alignment == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.Alignment = param;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
+ return;
}
-
- ctx->NewState |= _NEW_PACKUNPACK;
}
@@ -202,8 +249,7 @@ _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
{
GLint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelMapfv");
-
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (mapsize<0 || mapsize>MAX_PIXEL_MAP_TABLE) {
gl_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" );
@@ -226,6 +272,8 @@ _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
}
}
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+
switch (map) {
case GL_PIXEL_MAP_S_TO_S:
ctx->Pixel.MapStoSsize = mapsize;
@@ -298,7 +346,6 @@ _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
default:
gl_error( ctx, GL_INVALID_ENUM, "glPixelMapfv(map)" );
}
- ctx->NewState |= _NEW_PIXEL;
}
@@ -348,8 +395,7 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
@@ -397,8 +443,7 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
@@ -458,8 +503,7 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
@@ -532,107 +576,193 @@ void
_mesa_PixelTransferf( GLenum pname, GLfloat param )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelTransfer");
-
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (pname) {
case GL_MAP_COLOR:
+ if (ctx->Pixel.MapColorFlag == param ? GL_TRUE : GL_FALSE)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.MapColorFlag = param ? GL_TRUE : GL_FALSE;
break;
case GL_MAP_STENCIL:
+ if (ctx->Pixel.MapStencilFlag == param ? GL_TRUE : GL_FALSE)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.MapStencilFlag = param ? GL_TRUE : GL_FALSE;
break;
case GL_INDEX_SHIFT:
+ if (ctx->Pixel.IndexShift == (GLint) param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.IndexShift = (GLint) param;
break;
case GL_INDEX_OFFSET:
+ if (ctx->Pixel.IndexOffset == (GLint) param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.IndexOffset = (GLint) param;
break;
case GL_RED_SCALE:
+ if (ctx->Pixel.RedScale == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.RedScale = param;
break;
case GL_RED_BIAS:
+ if (ctx->Pixel.RedBias == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.RedBias = param;
break;
case GL_GREEN_SCALE:
+ if (ctx->Pixel.GreenScale == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.GreenScale = param;
break;
case GL_GREEN_BIAS:
+ if (ctx->Pixel.GreenBias == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.GreenBias = param;
break;
case GL_BLUE_SCALE:
+ if (ctx->Pixel.BlueScale == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.BlueScale = param;
break;
case GL_BLUE_BIAS:
+ if (ctx->Pixel.BlueBias == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.BlueBias = param;
break;
case GL_ALPHA_SCALE:
+ if (ctx->Pixel.AlphaScale == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.AlphaScale = param;
break;
case GL_ALPHA_BIAS:
+ if (ctx->Pixel.AlphaBias == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.AlphaBias = param;
break;
case GL_DEPTH_SCALE:
+ if (ctx->Pixel.DepthScale == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.DepthScale = param;
break;
case GL_DEPTH_BIAS:
+ if (ctx->Pixel.DepthBias == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.DepthBias = param;
break;
case GL_POST_COLOR_MATRIX_RED_SCALE:
+ if (ctx->Pixel.PostColorMatrixScale[0] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostColorMatrixScale[0] = param;
break;
case GL_POST_COLOR_MATRIX_RED_BIAS:
+ if (ctx->Pixel.PostColorMatrixBias[0] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostColorMatrixBias[0] = param;
break;
case GL_POST_COLOR_MATRIX_GREEN_SCALE:
+ if (ctx->Pixel.PostColorMatrixScale[1] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostColorMatrixScale[1] = param;
break;
case GL_POST_COLOR_MATRIX_GREEN_BIAS:
+ if (ctx->Pixel.PostColorMatrixBias[1] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostColorMatrixBias[1] = param;
break;
case GL_POST_COLOR_MATRIX_BLUE_SCALE:
+ if (ctx->Pixel.PostColorMatrixScale[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostColorMatrixScale[2] = param;
break;
case GL_POST_COLOR_MATRIX_BLUE_BIAS:
+ if (ctx->Pixel.PostColorMatrixBias[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostColorMatrixBias[2] = param;
break;
case GL_POST_COLOR_MATRIX_ALPHA_SCALE:
+ if (ctx->Pixel.PostColorMatrixScale[3] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostColorMatrixScale[3] = param;
break;
case GL_POST_COLOR_MATRIX_ALPHA_BIAS:
+ if (ctx->Pixel.PostColorMatrixBias[3] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostColorMatrixBias[3] = param;
break;
case GL_POST_CONVOLUTION_RED_SCALE:
+ if (ctx->Pixel.PostConvolutionScale[0] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostConvolutionScale[0] = param;
break;
case GL_POST_CONVOLUTION_RED_BIAS:
+ if (ctx->Pixel.PostConvolutionBias[0] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostConvolutionBias[0] = param;
break;
case GL_POST_CONVOLUTION_GREEN_SCALE:
+ if (ctx->Pixel.PostConvolutionScale[1] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostConvolutionScale[1] = param;
break;
case GL_POST_CONVOLUTION_GREEN_BIAS:
+ if (ctx->Pixel.PostConvolutionBias[1] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostConvolutionBias[1] = param;
break;
case GL_POST_CONVOLUTION_BLUE_SCALE:
+ if (ctx->Pixel.PostConvolutionScale[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostConvolutionScale[2] = param;
break;
case GL_POST_CONVOLUTION_BLUE_BIAS:
+ if (ctx->Pixel.PostConvolutionBias[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostConvolutionBias[2] = param;
break;
case GL_POST_CONVOLUTION_ALPHA_SCALE:
+ if (ctx->Pixel.PostConvolutionScale[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostConvolutionScale[2] = param;
break;
case GL_POST_CONVOLUTION_ALPHA_BIAS:
+ if (ctx->Pixel.PostConvolutionBias[2] == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostConvolutionBias[2] = param;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" );
return;
}
-
- /* signal to recompute the bitmask */
- ctx->NewState |= _NEW_PIXEL;
}
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index b70e5f05c4..3becddb34c 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -1,4 +1,4 @@
-/* $Id: points.c,v 1.25 2000/12/08 00:20:15 brianp Exp $ */
+/* $Id: points.c,v 1.26 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -44,21 +44,22 @@ void
_mesa_PointSize( GLfloat size )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointSize");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (size <= 0.0) {
gl_error( ctx, GL_INVALID_VALUE, "glPointSize" );
return;
}
- if (ctx->Point.Size != size) {
- ctx->Point.Size = size;
- ctx->Point._Size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
- ctx->_TriangleCaps &= ~DD_POINT_SIZE;
- if (size != 1.0)
- ctx->_TriangleCaps |= DD_POINT_SIZE;
- ctx->NewState |= _NEW_POINT;
- }
+ if (ctx->Point.Size == size)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.Size = size;
+ ctx->Point._Size = CLAMP(size,
+ ctx->Const.MinPointSize,
+ ctx->Const.MaxPointSize);
+ ctx->_TriangleCaps ^= DD_POINT_SIZE;
}
@@ -74,13 +75,22 @@ void
_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointParameterfvEXT");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (pname) {
case GL_DISTANCE_ATTENUATION_EXT:
{
const GLboolean tmp = ctx->Point._Attenuated;
+ if (TEST_EQ_3V(ctx->Point.Params, params))
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_POINT);
COPY_3V(ctx->Point.Params, params);
+
+ /* Update several derived values now. This likely to be
+ * more efficient than trying to catch this statechange in
+ * state.c.
+ */
ctx->Point._Attenuated = (params[0] != 1.0 ||
params[1] != 0.0 ||
params[2] != 0.0);
@@ -88,7 +98,6 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
if (tmp != ctx->Point._Attenuated) {
ctx->_Enabled ^= ENABLE_POINT_ATTEN;
ctx->_TriangleCaps ^= DD_POINT_ATTEN;
- /* XXX why is this here and not in state.c? */
ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN;
}
}
@@ -98,6 +107,9 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
return;
}
+ if (ctx->Point.MinSize == *params)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
ctx->Point.MinSize = *params;
break;
case GL_POINT_SIZE_MAX_EXT:
@@ -105,6 +117,9 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
return;
}
+ if (ctx->Point.MaxSize == *params)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
ctx->Point.MaxSize = *params;
break;
case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
@@ -112,13 +127,14 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
return;
}
+ if (ctx->Point.Threshold == *params)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
ctx->Point.Threshold = *params;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glPointParameterfvEXT" );
return;
}
-
- ctx->NewState |= _NEW_POINT;
}
diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
index b48d70eaf9..68bcbbe3b8 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -1,4 +1,4 @@
-/* $Id: polygon.c,v 1.16 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: polygon.c,v 1.17 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -44,7 +44,7 @@ void
_mesa_CullFace( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCullFace");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glCullFace %s\n", gl_lookup_enum_by_nr(mode));
@@ -54,8 +54,11 @@ _mesa_CullFace( GLenum mode )
return;
}
+ if (ctx->Polygon.CullFaceMode == mode)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.CullFaceMode = mode;
- ctx->NewState |= _NEW_POLYGON;
if (ctx->Driver.CullFace)
ctx->Driver.CullFace( ctx, mode );
@@ -67,7 +70,7 @@ void
_mesa_FrontFace( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFrontFace");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glFrontFace %s\n", gl_lookup_enum_by_nr(mode));
@@ -77,9 +80,13 @@ _mesa_FrontFace( GLenum mode )
return;
}
+ if (ctx->Polygon.FrontFace == mode)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.FrontFace = mode;
- ctx->Polygon.FrontBit = (GLboolean) (mode == GL_CW);
- ctx->NewState |= _NEW_POLYGON;
+
+ ctx->Polygon._FrontBit = (GLboolean) (mode == GL_CW);
if (ctx->Driver.FrontFace)
ctx->Driver.FrontFace( ctx, mode );
@@ -91,39 +98,47 @@ void
_mesa_PolygonMode( GLenum face, GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonMode");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glPolygonMode %s %s\n",
gl_lookup_enum_by_nr(face),
gl_lookup_enum_by_nr(mode));
- if (face!=GL_FRONT && face!=GL_BACK && face!=GL_FRONT_AND_BACK) {
- gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
- return;
- }
- else if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) {
+ if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) {
gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(mode)" );
return;
}
- if (face==GL_FRONT || face==GL_FRONT_AND_BACK) {
+ switch (face) {
+ case GL_FRONT:
+ if (ctx->Polygon.FrontMode == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.FrontMode = mode;
+ break;
+ case GL_FRONT_AND_BACK:
+ if (ctx->Polygon.FrontMode == mode &&
+ ctx->Polygon.BackMode == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.FrontMode = mode;
- }
- if (face==GL_BACK || face==GL_FRONT_AND_BACK) {
ctx->Polygon.BackMode = mode;
+ break;
+ case GL_BACK:
+ if (ctx->Polygon.BackMode == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->Polygon.BackMode = mode;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
+ return;
}
- /* Compute a handy "shortcut" value: */
ctx->_TriangleCaps &= ~DD_TRI_UNFILLED;
- ctx->Polygon._Unfilled = GL_FALSE;
-
- if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL) {
- ctx->Polygon._Unfilled = GL_TRUE;
+ if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL)
ctx->_TriangleCaps |= DD_TRI_UNFILLED;
- }
-
- ctx->NewState |= _NEW_POLYGON;
if (ctx->Driver.PolygonMode) {
(*ctx->Driver.PolygonMode)( ctx, face, mode );
@@ -136,15 +151,14 @@ void
_mesa_PolygonStipple( const GLubyte *pattern )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonStipple");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glPolygonStipple\n");
+ FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE);
_mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack);
- ctx->NewState |= _NEW_POLYGONSTIPPLE;
-
if (ctx->Driver.PolygonStipple)
ctx->Driver.PolygonStipple( ctx, (const GLubyte *) ctx->PolygonStipple );
}
@@ -155,7 +169,7 @@ void
_mesa_GetPolygonStipple( GLubyte *dest )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glGetPolygonStipple\n");
@@ -169,15 +183,19 @@ void
_mesa_PolygonOffset( GLfloat factor, GLfloat units )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
fprintf(stderr, "glPolygonOffset %f %f\n", factor, units);
+ if (ctx->Polygon.OffsetFactor == factor &&
+ ctx->Polygon.OffsetUnits == units)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.OffsetFactor = factor;
ctx->Polygon.OffsetUnits = units;
ctx->Polygon.OffsetMRD = units * ctx->Visual.MRD;
- ctx->NewState |= _NEW_POLYGON;
}
@@ -186,6 +204,5 @@ void
_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffsetEXT");
_mesa_PolygonOffset(factor, bias * ctx->Visual.DepthMaxF );
}
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 2865e7e0d4..e0204523c4 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -1,4 +1,4 @@
-/* $Id: rastpos.c,v 1.17 2000/11/27 18:22:13 brianp Exp $ */
+/* $Id: rastpos.c,v 1.18 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -241,14 +241,8 @@ static void raster_pos4f( GLcontext *ctx,
GLfloat x, GLfloat y, GLfloat z, GLfloat w )
{
GLfloat v[4], eye[4], clip[4], ndc[3], d;
-
- /* KW: Added this test, which is in the spec. We can't do this
- * inside begin/end any more because the ctx->Current values
- * aren't uptodate during that period.
- */
- FLUSH_TNL_RETURN(ctx, (FLUSH_INSIDE_BEGIN_END|
- FLUSH_STORED_VERTICES|
- FLUSH_UPDATE_CURRENT), "raster_pos4f");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_CURRENT(ctx, 0);
if (ctx->NewState)
gl_update_state( ctx );
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index e5ca69ea61..43e4872d66 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.52 2000/12/16 00:19:12 brianp Exp $ */
+/* $Id: state.c,v 1.53 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -26,8 +26,7 @@
/*
- * This file initializes the immediate-mode dispatch table (which may
- * be state-dependant) and manages internal Mesa state update.
+ * This file manages internal Mesa state update.
*/
@@ -80,13 +79,11 @@
#include "varray.h"
#include "winpos.h"
-#include "swrast/swrast.h"
#include "math/m_matrix.h"
#include "math/m_xform.h"
#endif
-
static int
generic_noop(void)
{
@@ -112,6 +109,7 @@ _mesa_init_no_op_table(struct _glapi_table *table, GLuint tableSize)
}
+
/*
* Initialize the given dispatch table with pointers to Mesa's
* immediate-mode commands.
@@ -501,27 +499,10 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
static void
update_polygon( GLcontext *ctx )
{
- ctx->_TriangleCaps &= ~DD_TRI_CULL_FRONT_BACK;
-
- /* Setup CullBits bitmask */
- if (ctx->Polygon.CullFlag) {
- switch(ctx->Polygon.CullFaceMode) {
- case GL_BACK:
- ctx->Polygon._CullBits = 1;
- break;
- case GL_FRONT:
- ctx->Polygon._CullBits = 2;
- break;
- default:
- case GL_FRONT_AND_BACK:
- ctx->Polygon._CullBits = 0;
- ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
- break;
- }
- }
- else {
- ctx->Polygon._CullBits = 3;
- }
+ ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
+
+/* if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) */
+/* ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK; */
/* Any Polygon offsets enabled? */
ctx->Polygon._OffsetAny = GL_FALSE;
@@ -587,8 +568,8 @@ update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords )
else {
GLuint new_state = ctx->NewState;
- /* Recalculate that same state if and only if it has been
- * invalidated by other statechanges.
+ /* Recalculate that same state only if it has been invalidated
+ * by other statechanges.
*/
if (new_state & _NEW_MODELVIEW)
update_modelview_scale(ctx);
@@ -652,7 +633,6 @@ update_projection( GLcontext *ctx )
}
-
/*
* Return a bitmask of IMAGE_*_BIT flags which to indicate which
* pixel transfer operations are enabled.
@@ -725,13 +705,17 @@ update_image_transfer_state(GLcontext *ctx)
* rendering any primitive. Basically, function pointers and miscellaneous
* flags are updated to reflect the current state of the state machine.
*
- * Special care is taken with the derived value _NeedEyeCoords. These
+ * The above constraint is now maintained largely by the two Exec
+ * dispatch tables, which trigger the appropriate flush on transition
+ * between State and Geometry modes.
+ *
+ * Special care is taken with the derived value _NeedEyeCoords. This
* is a bitflag which is updated with information from a number of
* attribute groups (MODELVIEW, LIGHT, TEXTURE). A lot of derived
* state references this value, and must be treated with care to
* ensure that updates are done correctly. All state dependent on
* _NeedEyeCoords is calculated from within _mesa_update_tnl_spaces(),
- * and from nowhere else.
+ * and from nowhere else.
*/
void gl_update_state( GLcontext *ctx )
{
@@ -755,7 +739,7 @@ void gl_update_state( GLcontext *ctx )
/* References ColorMatrix.type (derived above).
*/
- if (new_state & (_NEW_PIXEL|_NEW_COLOR_MATRIX))
+ if (new_state & _IMAGE_NEW_TRANSFER_STATE)
update_image_transfer_state(ctx);
/* Contributes to NeedEyeCoords, NeedNormals.
@@ -784,27 +768,20 @@ void gl_update_state( GLcontext *ctx )
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW;
}
- /* point attenuation requires eye coords */
- if (new_state & _NEW_POINT) {
- if (ctx->Point._Attenuated) {
- ctx->_NeedEyeCoords |= NEED_EYE_POINT_ATTEN;
- }
- }
- /* ctx->_NeedEyeCoords and ctx->_NeedEyeNormals are now uptodate.
+ /* ctx->_NeedEyeCoords is now uptodate.
*
- * If the truth value of either has changed, update for the new
- * lighting space and recompute the positions of lights and the
+ * If the truth value of this variable has changed, update for the
+ * new lighting space and recompute the positions of lights and the
* normal transform.
*
* If the lighting space hasn't changed, may still need to recompute
- * light positions & normal transforms for other reasons.
+ * light positions & normal transforms for other reasons.
*/
if (new_state & (_NEW_MODELVIEW |
_NEW_PROJECTION |
- _TNL_NEW_NORMAL_TRANSFORM |
_NEW_LIGHT |
- _TNL_NEW_NEED_EYE_COORDS))
+ _MESA_NEW_NEED_EYE_COORDS))
update_tnl_spaces( ctx, oldneedeyecoords );
/*
@@ -812,7 +789,12 @@ void gl_update_state( GLcontext *ctx )
* to it's specific, private functions, and performs any
* internal state management necessary, including invalidating
* state of active modules.
+ *
+ * Set ctx->NewState to zero to avoid recursion if
+ * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?)
*/
- ctx->Driver.UpdateState(ctx);
ctx->NewState = 0;
+ ctx->Driver.UpdateState(ctx, new_state);
+
+ ctx->Array.NewState = 0;
}
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
index 6aed338eb9..6775d58677 100644
--- a/src/mesa/main/stencil.c
+++ b/src/mesa/main/stencil.c
@@ -1,4 +1,4 @@
-/* $Id: stencil.c,v 1.23 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: stencil.c,v 1.24 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -45,9 +45,13 @@ void
_mesa_ClearStencil( GLint s )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearStencil");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Stencil.Clear == (GLstencil) s)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.Clear = (GLstencil) s;
- ctx->NewState |= _NEW_STENCIL;
if (ctx->Driver.ClearStencil) {
(*ctx->Driver.ClearStencil)( ctx, s );
@@ -61,8 +65,7 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
{
GET_CURRENT_CONTEXT(ctx);
GLint maxref;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilFunc");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (func) {
case GL_NEVER:
@@ -73,7 +76,6 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
case GL_EQUAL:
case GL_NOTEQUAL:
case GL_ALWAYS:
- ctx->Stencil.Function = func;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glStencilFunc" );
@@ -81,9 +83,17 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
}
maxref = (1 << STENCIL_BITS) - 1;
- ctx->Stencil.Ref = (GLstencil) CLAMP( ref, 0, maxref );
+ ref = (GLstencil) CLAMP( ref, 0, maxref );
+
+ if (ctx->Stencil.Function == func &&
+ ctx->Stencil.ValueMask == (GLstencil) mask &&
+ ctx->Stencil.Ref == ref)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.Function = func;
+ ctx->Stencil.Ref = ref;
ctx->Stencil.ValueMask = (GLstencil) mask;
- ctx->NewState |= _NEW_STENCIL;
if (ctx->Driver.StencilFunc) {
(*ctx->Driver.StencilFunc)( ctx, func, ctx->Stencil.Ref, mask );
@@ -96,9 +106,13 @@ void
_mesa_StencilMask( GLuint mask )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilMask");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Stencil.WriteMask == (GLstencil) mask)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.WriteMask = (GLstencil) mask;
- ctx->NewState |= _NEW_STENCIL;
if (ctx->Driver.StencilMask) {
(*ctx->Driver.StencilMask)( ctx, mask );
@@ -111,7 +125,8 @@ void
_mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilOp");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
switch (fail) {
case GL_KEEP:
case GL_ZERO:
@@ -123,8 +138,7 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
break;
case GL_INCR_WRAP_EXT:
case GL_DECR_WRAP_EXT:
- if (ctx->Extensions.EXT_stencil_wrap) {
- ctx->Stencil.FailFunc = fail;
+ if (!ctx->Extensions.EXT_stencil_wrap) {
break;
}
/* FALL-THROUGH */
@@ -139,12 +153,10 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
case GL_INCR:
case GL_DECR:
case GL_INVERT:
- ctx->Stencil.ZFailFunc = zfail;
break;
case GL_INCR_WRAP_EXT:
case GL_DECR_WRAP_EXT:
if (ctx->Extensions.EXT_stencil_wrap) {
- ctx->Stencil.ZFailFunc = zfail;
break;
}
/* FALL-THROUGH */
@@ -159,12 +171,10 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
case GL_INCR:
case GL_DECR:
case GL_INVERT:
- ctx->Stencil.ZPassFunc = zpass;
break;
case GL_INCR_WRAP_EXT:
case GL_DECR_WRAP_EXT:
if (ctx->Extensions.EXT_stencil_wrap) {
- ctx->Stencil.ZPassFunc = zpass;
break;
}
/* FALL-THROUGH */
@@ -173,7 +183,15 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
return;
}
- ctx->NewState |= _NEW_STENCIL;
+ if (ctx->Stencil.ZFailFunc == zfail &&
+ ctx->Stencil.ZPassFunc == zpass &&
+ ctx->Stencil.FailFunc == fail)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.ZFailFunc = zfail;
+ ctx->Stencil.ZPassFunc = zpass;
+ ctx->Stencil.FailFunc = fail;
if (ctx->Driver.StencilOp) {
(*ctx->Driver.StencilOp)(ctx, fail, zfail, zpass);
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 4b6e855abc..253acf65da 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.68 2000/12/14 20:25:56 brianp Exp $ */
+/* $Id: teximage.c,v 1.69 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -1612,7 +1612,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
{
GLsizei postConvWidth = width;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage1D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
adjust_texture_size_for_convolution(ctx, 1, &postConvWidth, NULL);
@@ -1743,7 +1743,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
{
GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage2D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
adjust_texture_size_for_convolution(ctx, 2, &postConvWidth,&postConvHeight);
@@ -1884,7 +1884,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
const GLvoid *pixels )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage3D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (target==GL_TEXTURE_3D_EXT) {
struct gl_texture_unit *texUnit;
@@ -2169,7 +2169,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
struct gl_texture_image *texImage;
GLboolean discardImage;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexImage");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (level < 0 || level >= ctx->Const.MaxTextureLevels) {
gl_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" );
@@ -2648,7 +2648,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
{
GLsizei postConvWidth = width;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage1D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState & _NEW_PIXEL)
gl_update_state(ctx);
@@ -2691,7 +2691,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
{
GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage2D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState & _NEW_PIXEL)
gl_update_state(ctx);
@@ -2733,7 +2733,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
{
GLsizei postConvWidth = width;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage1D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState & _NEW_PIXEL)
gl_update_state(ctx);
@@ -2783,7 +2783,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
{
GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage2D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState & _NEW_PIXEL)
gl_update_state(ctx);
@@ -2833,7 +2833,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
{
GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage3D");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->NewState & _NEW_PIXEL)
gl_update_state(ctx);
@@ -2883,7 +2883,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
const GLvoid *data)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage1DARB");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (internalFormat) {
case GL_COMPRESSED_ALPHA_ARB:
@@ -3010,7 +3010,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
const GLvoid *data)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage2DARB");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (internalFormat) {
case GL_COMPRESSED_ALPHA_ARB:
@@ -3145,7 +3145,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
GLsizei imageSize, const GLvoid *data)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage3DARB");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (internalFormat) {
case GL_COMPRESSED_ALPHA_ARB:
@@ -3386,7 +3386,7 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img)
const struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetCompressedTexImageARB");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (level < 0 || level >= ctx->Const.MaxTextureLevels) {
gl_error( ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)" );
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 68ce55b738..1204668dc3 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1,4 +1,4 @@
-/* $Id: texobj.c,v 1.36 2000/12/14 20:25:56 brianp Exp $ */
+/* $Id: texobj.c,v 1.37 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -420,8 +420,8 @@ _mesa_GenTextures( GLsizei n, GLuint *texName )
GET_CURRENT_CONTEXT(ctx);
GLuint first;
GLint i;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGenTextures");
if (n < 0) {
gl_error( ctx, GL_INVALID_VALUE, "glGenTextures" );
return;
@@ -462,8 +462,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName)
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteTextures");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
if (!texName)
return;
@@ -525,13 +524,12 @@ _mesa_BindTexture( GLenum target, GLuint texName )
struct gl_texture_object *oldTexObj;
struct gl_texture_object *newTexObj;
GLuint targetDim;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "glBindTexture %s %d\n",
gl_lookup_enum_by_nr(target), (GLint) texName);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBindTexture");
-
switch (target) {
case GL_TEXTURE_1D:
targetDim = 1;
@@ -607,7 +605,11 @@ _mesa_BindTexture( GLenum target, GLuint texName )
newTexObj->RefCount++;
- /* do the actual binding */
+
+ /* do the actual binding, but first flush outstanding vertices:
+ */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+
switch (target) {
case GL_TEXTURE_1D:
texUnit->Current1D = newTexObj;
@@ -625,8 +627,6 @@ _mesa_BindTexture( GLenum target, GLuint texName )
gl_problem(ctx, "bad target in BindTexture");
}
- ctx->NewState |= _NEW_TEXTURE;
-
/* Pass BindTexture call to device driver */
if (ctx->Driver.BindTexture)
(*ctx->Driver.BindTexture)( ctx, target, newTexObj );
@@ -654,8 +654,8 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPrioritizeTextures");
if (n < 0) {
gl_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" );
return;
@@ -691,9 +691,8 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
GET_CURRENT_CONTEXT(ctx);
GLboolean allResident = GL_TRUE;
GLint i;
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx,
- "glAreTexturesResident", GL_FALSE);
if (n < 0) {
gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)");
return GL_FALSE;
@@ -737,13 +736,7 @@ GLboolean
_mesa_IsTexture( GLuint texture )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures",
- GL_FALSE);
- if (texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture)) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+ return texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture);
}
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index eee2a3a6ae..a34d60653d 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.25 2000/11/24 10:25:06 keithw Exp $ */
+/* $Id: texstate.c,v 1.26 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -69,259 +69,294 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
{
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexEnv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (target==GL_TEXTURE_ENV) {
switch (pname) {
- case GL_TEXTURE_ENV_MODE:
- {
- GLenum mode = (GLenum) (GLint) *param;
- switch (mode) {
- case GL_MODULATE:
- case GL_BLEND:
- case GL_DECAL:
- case GL_REPLACE:
- case GL_ADD:
- case GL_COMBINE_EXT:
- if (mode == GL_ADD &&
- !ctx->Extensions.EXT_texture_env_add) {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
- return;
- }
- if (mode == GL_COMBINE_EXT &&
- !ctx->Extensions.EXT_texture_env_combine) {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
- return;
- }
- if (texUnit->EnvMode == mode)
- return; /* no change */
- texUnit->EnvMode = mode;
- break;
- default:
- gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
- return;
- }
- }
- break;
- case GL_TEXTURE_ENV_COLOR:
- texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F );
- texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F );
- texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F );
- texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F );
- break;
- case GL_COMBINE_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
- GLenum mode = (GLenum) (GLint) *param;
- switch (mode) {
- case GL_REPLACE:
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED_EXT:
- case GL_INTERPOLATE_EXT:
- if (texUnit->CombineModeRGB == mode)
- return; /* no change */
- texUnit->CombineModeRGB = mode;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
- return;
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
- break;
- case GL_COMBINE_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
- GLenum mode = (GLenum) (GLint) *param;
- switch (mode) {
- case GL_REPLACE:
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED_EXT:
- case GL_INTERPOLATE_EXT:
- if (texUnit->CombineModeA == mode)
- return; /* no change */
- texUnit->CombineModeA = mode;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
- return;
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
- break;
- case GL_SOURCE0_RGB_EXT:
- case GL_SOURCE1_RGB_EXT:
- case GL_SOURCE2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
- GLenum source = (GLenum) (GLint) *param;
- GLuint s = pname - GL_SOURCE0_RGB_EXT;
- switch (source) {
- case GL_TEXTURE:
- case GL_CONSTANT_EXT:
- case GL_PRIMARY_COLOR_EXT:
- case GL_PREVIOUS_EXT:
- if (texUnit->CombineSourceRGB[s] == source)
- return; /* no change */
- texUnit->CombineSourceRGB[s] = source;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
- return;
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
- break;
- case GL_SOURCE0_ALPHA_EXT:
- case GL_SOURCE1_ALPHA_EXT:
- case GL_SOURCE2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
- GLenum source = (GLenum) (GLint) *param;
- GLuint s = pname - GL_SOURCE0_ALPHA_EXT;
- switch (source) {
- case GL_TEXTURE:
- case GL_CONSTANT_EXT:
- case GL_PRIMARY_COLOR_EXT:
- case GL_PREVIOUS_EXT:
- if (texUnit->CombineSourceA[s] == source) return;
- texUnit->CombineSourceA[s] = source;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
- return;
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
- break;
- case GL_OPERAND0_RGB_EXT:
- case GL_OPERAND1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
- GLenum operand = (GLenum) (GLint) *param;
- GLuint s = pname - GL_OPERAND0_RGB_EXT;
- switch (operand) {
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- texUnit->CombineOperandRGB[s] = operand;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
- return;
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
- break;
- case GL_OPERAND0_ALPHA_EXT:
- case GL_OPERAND1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
- GLenum operand = (GLenum) (GLint) *param;
- switch (operand) {
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT]
- = operand;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
- return;
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
- break;
- case GL_OPERAND2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
- if ((GLenum) (GLint) *param == GL_SRC_ALPHA) {
- texUnit->CombineOperandRGB[2] = (GLenum) (GLint) *param;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
- return;
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
- break;
- case GL_OPERAND2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
- if ((GLenum) (GLint) *param == GL_SRC_ALPHA) {
- texUnit->CombineOperandA[2] = (GLenum) (GLint) *param;
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
- return;
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
- break;
- case GL_RGB_SCALE_EXT:
- if (ctx->Extensions.EXT_texture_env_combine) {
- if (*param == 1.0) {
- texUnit->CombineScaleShiftRGB = 0;
- }
- else if (*param == 2.0) {
- texUnit->CombineScaleShiftRGB = 1;
- }
- else if (*param == 4.0) {
- texUnit->CombineScaleShiftRGB = 2;
- }
- else {
- gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
- return;
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
- break;
- case GL_ALPHA_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine) {
- if (*param == 1.0) {
- texUnit->CombineScaleShiftA = 0;
- }
- else if (*param == 2.0) {
- texUnit->CombineScaleShiftA = 1;
- }
- else if (*param == 4.0) {
- texUnit->CombineScaleShiftA = 2;
- }
- else {
- gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
- return;
- }
- }
- else {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
- return;
- }
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
- return;
+ case GL_TEXTURE_ENV_MODE: {
+ GLenum mode = (GLenum) (GLint) *param;
+
+ switch (mode) {
+ case GL_ADD:
+ if (!ctx->Extensions.EXT_texture_env_add) {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
+ return;
+ }
+ break;
+ case GL_COMBINE_EXT:
+ if (!ctx->Extensions.EXT_texture_env_combine) {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
+ return;
+ }
+ break;
+ case GL_MODULATE:
+ case GL_BLEND:
+ case GL_DECAL:
+ case GL_REPLACE:
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
+ return;
+ }
+
+ if (texUnit->EnvMode == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->EnvMode = mode;
+ break;
+ }
+ case GL_TEXTURE_ENV_COLOR: {
+ GLfloat tmp[4];
+ tmp[0] = CLAMP( param[0], 0.0F, 1.0F );
+ tmp[1] = CLAMP( param[1], 0.0F, 1.0F );
+ tmp[2] = CLAMP( param[2], 0.0F, 1.0F );
+ tmp[3] = CLAMP( param[3], 0.0F, 1.0F );
+ if (TEST_EQ_4V(tmp, texUnit->EnvColor))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EnvColor, tmp);
+ break;
+ }
+ case GL_COMBINE_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine) {
+ GLenum mode = (GLenum) (GLint) *param;
+ switch (mode) {
+ case GL_REPLACE:
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED_EXT:
+ case GL_INTERPOLATE_EXT:
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ if (texUnit->CombineModeRGB == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineModeRGB = mode;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ case GL_COMBINE_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine) {
+ GLenum mode = (GLenum) (GLint) *param;
+ switch (mode) {
+ case GL_REPLACE:
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED_EXT:
+ case GL_INTERPOLATE_EXT:
+ if (texUnit->CombineModeA == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineModeA = mode;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_SOURCE0_RGB_EXT:
+ case GL_SOURCE1_RGB_EXT:
+ case GL_SOURCE2_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine) {
+ GLenum source = (GLenum) (GLint) *param;
+ GLuint s = pname - GL_SOURCE0_RGB_EXT;
+ switch (source) {
+ case GL_TEXTURE:
+ case GL_CONSTANT_EXT:
+ case GL_PRIMARY_COLOR_EXT:
+ case GL_PREVIOUS_EXT:
+ if (texUnit->CombineSourceRGB[s] == source)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineSourceRGB[s] = source;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_SOURCE0_ALPHA_EXT:
+ case GL_SOURCE1_ALPHA_EXT:
+ case GL_SOURCE2_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine) {
+ GLenum source = (GLenum) (GLint) *param;
+ GLuint s = pname - GL_SOURCE0_ALPHA_EXT;
+ switch (source) {
+ case GL_TEXTURE:
+ case GL_CONSTANT_EXT:
+ case GL_PRIMARY_COLOR_EXT:
+ case GL_PREVIOUS_EXT:
+ if (texUnit->CombineSourceA[s] == source) return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineSourceA[s] = source;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_OPERAND0_RGB_EXT:
+ case GL_OPERAND1_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine) {
+ GLenum operand = (GLenum) (GLint) *param;
+ GLuint s = pname - GL_OPERAND0_RGB_EXT;
+ switch (operand) {
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ if (texUnit->CombineOperandRGB[s] == operand)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineOperandRGB[s] = operand;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_OPERAND0_ALPHA_EXT:
+ case GL_OPERAND1_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine) {
+ GLenum operand = (GLenum) (GLint) *param;
+ switch (operand) {
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ if (texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] ==
+ operand)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] = operand;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_OPERAND2_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine) {
+ GLenum operand = (GLenum) (GLint) *param;
+ switch (operand) {
+ case GL_SRC_ALPHA:
+ if (texUnit->CombineOperandRGB[2] == operand)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineOperandRGB[2] = operand;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_OPERAND2_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine) {
+ GLenum operand = (GLenum) (GLint) *param;
+ switch (operand) {
+ case GL_SRC_ALPHA:
+ if (texUnit->CombineOperandA[2] == operand)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineOperandA[2] = operand;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_RGB_SCALE_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine) {
+ GLuint newshift;
+ if (*param == 1.0) {
+ newshift = 0;
+ }
+ else if (*param == 2.0) {
+ newshift = 1;
+ }
+ else if (*param == 4.0) {
+ newshift = 2;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
+ return;
+ }
+ if (texUnit->CombineScaleShiftRGB == newshift)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineScaleShiftRGB = newshift;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine) {
+ GLuint newshift;
+ if (*param == 1.0) {
+ newshift = 0;
+ }
+ else if (*param == 2.0) {
+ newshift = 1;
+ }
+ else if (*param == 4.0) {
+ newshift = 2;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
+ return;
+ }
+ if (texUnit->CombineScaleShiftA == newshift)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineScaleShiftA = newshift;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ return;
+ }
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ return;
}
}
else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) {
@@ -329,10 +364,14 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
return;
}
- if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
+ switch (pname) {
+ case GL_TEXTURE_LOD_BIAS_EXT:
+ if (texUnit->LodBias == param[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->LodBias = param[0];
- }
- else {
+ break;
+ default:
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
return;
}
@@ -353,8 +392,6 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
if (ctx->Driver.TexEnv) {
(*ctx->Driver.TexEnv)( ctx, target, pname, param );
}
-
- ctx->NewState |= _NEW_TEXTURE;
}
@@ -393,8 +430,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexEnvfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (target!=GL_TEXTURE_ENV) {
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
@@ -447,8 +483,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexEnviv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (target != GL_TEXTURE_ENV) {
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
@@ -604,8 +639,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
GLenum eparam = (GLenum) (GLint) params[0];
struct gl_texture_object *texObj;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexParameterfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "texPARAM %s %s %d...\n",
@@ -806,8 +840,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
const struct gl_texture_image *img = NULL;
GLuint dimensions;
GLboolean isProxy;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexLevelParameter");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (level < 0 || level >= ctx->Const.MaxTextureLevels) {
gl_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" );
@@ -919,8 +952,7 @@ _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_object *obj;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexParameterfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
obj = _mesa_select_tex_object(ctx, texUnit, target);
if (!obj) {
@@ -987,8 +1019,7 @@ _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_object *obj;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexParameteriv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
obj = _mesa_select_tex_object(ctx, texUnit, target);
if (!obj) {
@@ -1069,7 +1100,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
GET_CURRENT_CONTEXT(ctx);
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexGenfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "texGEN %s %s %x...\n",
@@ -1081,45 +1112,54 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_S:
if (pname==GL_TEXTURE_GEN_MODE) {
GLenum mode = (GLenum) (GLint) *params;
+ GLuint bits;
switch (mode) {
case GL_OBJECT_LINEAR:
- texUnit->GenModeS = mode;
- texUnit->_GenBitS = TEXGEN_OBJ_LINEAR;
+ bits = TEXGEN_OBJ_LINEAR;
break;
case GL_EYE_LINEAR:
- texUnit->GenModeS = mode;
- texUnit->_GenBitS = TEXGEN_EYE_LINEAR;
+ bits = TEXGEN_EYE_LINEAR;
break;
case GL_REFLECTION_MAP_NV:
- texUnit->GenModeS = mode;
- texUnit->_GenBitS = TEXGEN_REFLECTION_MAP_NV;
+ bits = TEXGEN_REFLECTION_MAP_NV;
break;
case GL_NORMAL_MAP_NV:
- texUnit->GenModeS = mode;
- texUnit->_GenBitS = TEXGEN_NORMAL_MAP_NV;
+ bits = TEXGEN_NORMAL_MAP_NV;
break;
case GL_SPHERE_MAP:
- texUnit->GenModeS = mode;
- texUnit->_GenBitS = TEXGEN_SPHERE_MAP;
+ bits = TEXGEN_SPHERE_MAP;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
+ if (texUnit->GenModeS == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeS = mode;
+ texUnit->_GenBitS = bits;
}
else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneS, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->ObjectPlaneS[0] = params[0];
texUnit->ObjectPlaneS[1] = params[1];
texUnit->ObjectPlaneS[2] = params[2];
texUnit->ObjectPlaneS[3] = params[3];
}
else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
+
/* Transform plane equation by the inverse modelview matrix */
if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
_math_matrix_analyse( &ctx->ModelView );
}
- gl_transform_vector( texUnit->EyePlaneS, params,
- ctx->ModelView.inv );
+ gl_transform_vector( tmp, params, ctx->ModelView.inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneS, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneS, tmp);
}
else {
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
@@ -1129,45 +1169,53 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_T:
if (pname==GL_TEXTURE_GEN_MODE) {
GLenum mode = (GLenum) (GLint) *params;
+ GLuint bitt;
switch (mode) {
case GL_OBJECT_LINEAR:
- texUnit->GenModeT = GL_OBJECT_LINEAR;
- texUnit->_GenBitT = TEXGEN_OBJ_LINEAR;
+ bitt = TEXGEN_OBJ_LINEAR;
break;
case GL_EYE_LINEAR:
- texUnit->GenModeT = GL_EYE_LINEAR;
- texUnit->_GenBitT = TEXGEN_EYE_LINEAR;
+ bitt = TEXGEN_EYE_LINEAR;
break;
case GL_REFLECTION_MAP_NV:
- texUnit->GenModeT = GL_REFLECTION_MAP_NV;
- texUnit->_GenBitT = TEXGEN_REFLECTION_MAP_NV;
+ bitt = TEXGEN_REFLECTION_MAP_NV;
break;
case GL_NORMAL_MAP_NV:
- texUnit->GenModeT = GL_NORMAL_MAP_NV;
- texUnit->_GenBitT = TEXGEN_NORMAL_MAP_NV;
+ bitt = TEXGEN_NORMAL_MAP_NV;
break;
case GL_SPHERE_MAP:
- texUnit->GenModeT = GL_SPHERE_MAP;
- texUnit->_GenBitT = TEXGEN_SPHERE_MAP;
+ bitt = TEXGEN_SPHERE_MAP;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
+ if (texUnit->GenModeT == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeT = mode;
+ texUnit->_GenBitT = bitt;
}
else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneT, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->ObjectPlaneT[0] = params[0];
texUnit->ObjectPlaneT[1] = params[1];
texUnit->ObjectPlaneT[2] = params[2];
texUnit->ObjectPlaneT[3] = params[3];
}
else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
/* Transform plane equation by the inverse modelview matrix */
- if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
+ if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
_math_matrix_analyse( &ctx->ModelView );
}
- gl_transform_vector( texUnit->EyePlaneT, params,
- ctx->ModelView.inv );
+ gl_transform_vector( tmp, params, ctx->ModelView.inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneT, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneT, tmp);
}
else {
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
@@ -1177,41 +1225,50 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_R:
if (pname==GL_TEXTURE_GEN_MODE) {
GLenum mode = (GLenum) (GLint) *params;
+ GLuint bitr;
switch (mode) {
case GL_OBJECT_LINEAR:
- texUnit->GenModeR = GL_OBJECT_LINEAR;
- texUnit->_GenBitR = TEXGEN_OBJ_LINEAR;
+ bitr = TEXGEN_OBJ_LINEAR;
break;
case GL_REFLECTION_MAP_NV:
- texUnit->GenModeR = GL_REFLECTION_MAP_NV;
- texUnit->_GenBitR = TEXGEN_REFLECTION_MAP_NV;
+ bitr = TEXGEN_REFLECTION_MAP_NV;
break;
case GL_NORMAL_MAP_NV:
- texUnit->GenModeR = GL_NORMAL_MAP_NV;
- texUnit->_GenBitR = TEXGEN_NORMAL_MAP_NV;
+ bitr = TEXGEN_NORMAL_MAP_NV;
break;
case GL_EYE_LINEAR:
- texUnit->GenModeR = GL_EYE_LINEAR;
- texUnit->_GenBitR = TEXGEN_EYE_LINEAR;
+ bitr = TEXGEN_EYE_LINEAR;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
+ if (texUnit->GenModeR == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeR = mode;
+ texUnit->_GenBitR = bitr;
}
else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneR, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->ObjectPlaneR[0] = params[0];
texUnit->ObjectPlaneR[1] = params[1];
texUnit->ObjectPlaneR[2] = params[2];
texUnit->ObjectPlaneR[3] = params[3];
}
else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
/* Transform plane equation by the inverse modelview matrix */
if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
_math_matrix_analyse( &ctx->ModelView );
}
- gl_transform_vector( texUnit->EyePlaneR, params,
- ctx->ModelView.inv );
+ gl_transform_vector( tmp, params, ctx->ModelView.inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneR, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneR, tmp);
}
else {
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
@@ -1221,33 +1278,44 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_Q:
if (pname==GL_TEXTURE_GEN_MODE) {
GLenum mode = (GLenum) (GLint) *params;
+ GLuint bitq;
switch (mode) {
case GL_OBJECT_LINEAR:
- texUnit->GenModeQ = GL_OBJECT_LINEAR;
- texUnit->_GenBitQ = TEXGEN_OBJ_LINEAR;
+ bitq = TEXGEN_OBJ_LINEAR;
break;
case GL_EYE_LINEAR:
- texUnit->GenModeQ = GL_EYE_LINEAR;
- texUnit->_GenBitQ = TEXGEN_EYE_LINEAR;
+ bitq = TEXGEN_EYE_LINEAR;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
+ if (texUnit->GenModeQ == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeQ = mode;
+ texUnit->_GenBitQ = bitq;
}
else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneQ, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->ObjectPlaneQ[0] = params[0];
texUnit->ObjectPlaneQ[1] = params[1];
texUnit->ObjectPlaneQ[2] = params[2];
texUnit->ObjectPlaneQ[3] = params[3];
}
else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
/* Transform plane equation by the inverse modelview matrix */
if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
_math_matrix_analyse( &ctx->ModelView );
}
- gl_transform_vector( texUnit->EyePlaneQ, params,
- ctx->ModelView.inv );
+ gl_transform_vector( tmp, params, ctx->ModelView.inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneQ, tmp);
}
else {
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
@@ -1261,8 +1329,6 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
if (ctx->Driver.TexGen)
ctx->Driver.TexGen( ctx, coord, pname, params );
-
- ctx->NewState |= _NEW_TEXTURE;
}
@@ -1319,8 +1385,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
GET_CURRENT_CONTEXT(ctx);
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGendv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (coord) {
case GL_S:
@@ -1397,8 +1462,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
GET_CURRENT_CONTEXT(ctx);
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGenfv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (coord) {
case GL_S:
@@ -1475,8 +1539,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
GET_CURRENT_CONTEXT(ctx);
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGeniv");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (coord) {
case GL_S:
@@ -1575,25 +1638,23 @@ void
_mesa_ActiveTextureARB( GLenum target )
{
GET_CURRENT_CONTEXT(ctx);
- GLint maxUnits = ctx->Const.MaxTextureUnits;
-
- ASSERT_OUTSIDE_BEGIN_END( ctx, "glActiveTextureARB" );
+ GLuint texUnit = target - GL_TEXTURE0_ARB;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "glActiveTexture %s\n",
gl_lookup_enum_by_nr(target));
- if (target >= GL_TEXTURE0_ARB && target < GL_TEXTURE0_ARB + maxUnits) {
- GLint texUnit = target - GL_TEXTURE0_ARB;
- ctx->Texture.CurrentUnit = texUnit;
- ctx->Texture.CurrentTransformUnit = texUnit;
- if (ctx->Driver.ActiveTexture) {
- (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit );
- }
- ctx->NewState |= _NEW_TEXTURE;
- }
- else {
+ if (texUnit > ctx->Const.MaxTextureUnits) {
gl_error(ctx, GL_INVALID_OPERATION, "glActiveTextureARB(target)");
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ ctx->Texture.CurrentUnit = texUnit;
+ ctx->Texture.CurrentTransformUnit = texUnit;
+ if (ctx->Driver.ActiveTexture) {
+ (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit );
}
}
@@ -1603,16 +1664,14 @@ void
_mesa_ClientActiveTextureARB( GLenum target )
{
GET_CURRENT_CONTEXT(ctx);
- GLint maxUnits = ctx->Const.MaxTextureUnits;
-
- ASSERT_OUTSIDE_BEGIN_END( ctx, "glClientActiveTextureARB" );
+ GLuint texUnit = target - GL_TEXTURE0_ARB;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (target >= GL_TEXTURE0_ARB && target < GL_TEXTURE0_ARB + maxUnits) {
- GLint texUnit = target - GL_TEXTURE0_ARB;
- ctx->Array.ActiveTexture = texUnit;
- ctx->NewState |= _NEW_ARRAY;
- }
- else {
+ if (texUnit > ctx->Const.MaxTextureUnits) {
gl_error(ctx, GL_INVALID_OPERATION, "glActiveTextureARB(target)");
+ return;
}
+
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ ctx->Array.ActiveTexture = texUnit;
}
diff --git a/src/mesa/main/texutil.c b/src/mesa/main/texutil.c
index 6ccc2f215a..428af0384a 100644
--- a/src/mesa/main/texutil.c
+++ b/src/mesa/main/texutil.c
@@ -1,4 +1,4 @@
-/* $Id: texutil.c,v 1.10 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: texutil.c,v 1.11 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -135,6 +135,10 @@ _mesa_convert_teximage(MesaIntTexFormat dstFormat,
GLubyte *dst = (GLubyte *) dstImage;
GLint row;
for (row = 0; row < dstHeight; row++) {
+ GLuint i;
+ for (i = 0 ; i < dstWidth ; i++)
+ fprintf(stderr, "%02x ", src[i]);
+ fprintf(stderr, "\n");
MEMCPY(dst, src, dstWidth * sizeof(GLubyte));
dst += dstRowStride;
src += srcStride;
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 7b9b1052c2..9fa20997cf 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1,4 +1,4 @@
-/* $Id: varray.c,v 1.33 2000/11/24 10:25:06 keithw Exp $ */
+/* $Id: varray.c,v 1.34 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -48,6 +48,7 @@ void
_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
{
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (size<2 || size>4) {
gl_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" );
@@ -87,8 +88,8 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
ctx->Array.Vertex.Type = type;
ctx->Array.Vertex.Stride = stride;
ctx->Array.Vertex.Ptr = (void *) ptr;
- ctx->Array._VertexFunc = gl_trans_4f_tab[size][TYPE_IDX(type)];
ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
if (ctx->Driver.VertexPointer)
ctx->Driver.VertexPointer( ctx, size, type, stride, ptr );
@@ -101,6 +102,7 @@ void
_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
{
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (stride<0) {
gl_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" );
@@ -138,8 +140,8 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
ctx->Array.Normal.Type = type;
ctx->Array.Normal.Stride = stride;
ctx->Array.Normal.Ptr = (void *) ptr;
- ctx->Array._NormalFunc = gl_trans_3f_tab[TYPE_IDX(type)];
ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
if (ctx->Driver.NormalPointer)
ctx->Driver.NormalPointer( ctx, type, stride, ptr );
@@ -151,6 +153,7 @@ void
_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
{
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (size<3 || size>4) {
gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" );
@@ -202,8 +205,8 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
ctx->Array.Color.Type = type;
ctx->Array.Color.Stride = stride;
ctx->Array.Color.Ptr = (void *) ptr;
- ctx->Array._ColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)];
ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
if (ctx->Driver.ColorPointer)
ctx->Driver.ColorPointer( ctx, size, type, stride, ptr );
@@ -215,6 +218,7 @@ void
_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
{
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (stride<0) {
gl_error( ctx, GL_INVALID_VALUE, "glFogCoordPointer(stride)" );
@@ -238,8 +242,8 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
ctx->Array.FogCoord.Type = type;
ctx->Array.FogCoord.Stride = stride;
ctx->Array.FogCoord.Ptr = (void *) ptr;
- ctx->Array._FogCoordFunc = gl_trans_1f_tab[TYPE_IDX(type)];
ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
if (ctx->Driver.FogCoordPointer)
ctx->Driver.FogCoordPointer( ctx, type, stride, ptr );
@@ -250,6 +254,7 @@ void
_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
{
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (stride<0) {
gl_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" );
@@ -282,8 +287,8 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
ctx->Array.Index.Type = type;
ctx->Array.Index.Stride = stride;
ctx->Array.Index.Ptr = (void *) ptr;
- ctx->Array._IndexFunc = gl_trans_1ui_tab[TYPE_IDX(type)];
ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
if (ctx->Driver.IndexPointer)
ctx->Driver.IndexPointer( ctx, type, stride, ptr );
@@ -295,6 +300,7 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
GLsizei stride, const GLvoid *ptr)
{
GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (size != 3 && size != 4) {
gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" );
@@ -346,8 +352,8 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
ctx->Array.SecondaryColor.Type = type;
ctx->Array.SecondaryColor.Stride = stride;
ctx->Array.SecondaryColor.Ptr = (void *) ptr;
- ctx->Array._SecondaryColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)];
ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
if (ctx->Driver.SecondaryColorPointer)
ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr );
@@ -359,9 +365,8 @@ void
_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
{
GET_CURRENT_CONTEXT(ctx);
- GLuint texUnit;
-
- texUnit = ctx->Array.ActiveTexture;
+ GLuint texUnit = ctx->Array.ActiveTexture;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (size<1 || size>4) {
gl_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(size)" );
@@ -403,8 +408,8 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr
ctx->Array.TexCoord[texUnit].Type = type;
ctx->Array.TexCoord[texUnit].Stride = stride;
ctx->Array.TexCoord[texUnit].Ptr = (void *) ptr;
- ctx->Array._TexCoordFunc[texUnit] = gl_trans_4f_tab[size][TYPE_IDX(type)];
ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
if (ctx->Driver.TexCoordPointer)
ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr );
@@ -418,6 +423,7 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr)
{
GET_CURRENT_CONTEXT(ctx);
const GLboolean *ptr = (GLboolean *)vptr;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (stride<0) {
gl_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" );
@@ -426,12 +432,8 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr)
ctx->Array.EdgeFlag.Stride = stride;
ctx->Array.EdgeFlag.StrideB = stride ? stride : sizeof(GLboolean);
ctx->Array.EdgeFlag.Ptr = (GLboolean *) ptr;
- if (stride != sizeof(GLboolean)) {
- ctx->Array._EdgeFlagFunc = gl_trans_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)];
- } else {
- ctx->Array._EdgeFlagFunc = 0;
- }
ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
if (ctx->Driver.EdgeFlagPointer)
ctx->Driver.EdgeFlagPointer( ctx, stride, ptr );
@@ -511,6 +513,8 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
GLint c, f;
GLint coordUnitSave;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
f = sizeof(GLfloat);
c = f * ((4*sizeof(GLubyte) + (f-1)) / f);
@@ -645,8 +649,8 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
for (i = 0; i < factor; i++) {
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
_mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY );
- glTexCoordPointer( tcomps, GL_FLOAT, stride,
- (GLubyte *) pointer + i * coffset );
+ _mesa_TexCoordPointer( tcomps, GL_FLOAT, stride,
+ (GLubyte *) pointer + i * coffset );
}
for (i = factor; i < ctx->Const.MaxTextureUnits; i++) {
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
@@ -667,8 +671,8 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
/* Color */
if (cflag) {
_mesa_EnableClientState( GL_COLOR_ARRAY );
- glColorPointer( ccomps, ctype, stride,
- (GLubyte*) pointer + coffset );
+ _mesa_ColorPointer( ccomps, ctype, stride,
+ (GLubyte*) pointer + coffset );
}
else {
_mesa_DisableClientState( GL_COLOR_ARRAY );
@@ -678,29 +682,25 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
/* Normals */
if (nflag) {
_mesa_EnableClientState( GL_NORMAL_ARRAY );
- glNormalPointer( GL_FLOAT, stride,
- (GLubyte*) pointer + noffset );
+ _mesa_NormalPointer( GL_FLOAT, stride,
+ (GLubyte*) pointer + noffset );
}
else {
_mesa_DisableClientState( GL_NORMAL_ARRAY );
}
_mesa_EnableClientState( GL_VERTEX_ARRAY );
- glVertexPointer( vcomps, GL_FLOAT, stride,
- (GLubyte *) pointer + voffset );
+ _mesa_VertexPointer( vcomps, GL_FLOAT, stride,
+ (GLubyte *) pointer + voffset );
}
-/* Transform the array components now, upto the setup call. When
- * actual draw commands arrive, the data will be merged prior to
- * calling render_vb.
- */
void
_mesa_LockArraysEXT(GLint first, GLsizei count)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glLockArraysEXT" );
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glLockArrays %d %d\n", first, count);
@@ -715,6 +715,7 @@ _mesa_LockArraysEXT(GLint first, GLsizei count)
}
ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_ALL;
if (ctx->Driver.LockArraysEXT)
ctx->Driver.LockArraysEXT( ctx, first, count );
@@ -725,7 +726,7 @@ void
_mesa_UnlockArraysEXT( void )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glUnlockArraysEXT" );
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glUnlockArrays\n");
@@ -733,6 +734,7 @@ _mesa_UnlockArraysEXT( void )
ctx->Array.LockFirst = 0;
ctx->Array.LockCount = 0;
ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_ALL;
if (ctx->Driver.UnlockArraysEXT)
ctx->Driver.UnlockArraysEXT( ctx );