summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-01-22 14:35:16 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-01-22 14:35:16 +0000
commit4c8fadc6d996c8c433826c4c763104b7d69cf7e5 (patch)
tree3e85b89009cf5beaf25c28bbe3748f1c90ef9cab
parent9b681dcc17c9c6d25aa40fa59cd617ae911cf988 (diff)
Clean-up/renaming of the per-vertex attribute bits, specifically, the
VERT_BIT_* flags are new and used in many places (esp in T&L code). Updated some comments for doxygen. Various code clean-ups.
-rw-r--r--src/mesa/main/mtypes.h173
-rw-r--r--src/mesa/tnl/t_array_api.c33
-rw-r--r--src/mesa/tnl/t_array_import.c89
-rw-r--r--src/mesa/tnl/t_context.h212
-rw-r--r--src/mesa/tnl/t_imm_api.c78
-rw-r--r--src/mesa/tnl/t_imm_debug.c86
-rw-r--r--src/mesa/tnl/t_imm_dlist.c60
-rw-r--r--src/mesa/tnl/t_imm_elt.c44
-rw-r--r--src/mesa/tnl/t_imm_eval.c138
-rw-r--r--src/mesa/tnl/t_imm_exec.c122
-rw-r--r--src/mesa/tnl/t_imm_fixup.c207
-rw-r--r--src/mesa/tnl/t_pipeline.c4
-rw-r--r--src/mesa/tnl/t_vb_fog.c8
-rw-r--r--src/mesa/tnl/t_vb_light.c20
-rw-r--r--src/mesa/tnl/t_vb_lighttmp.h20
-rw-r--r--src/mesa/tnl/t_vb_normals.c6
-rw-r--r--src/mesa/tnl/t_vb_points.c6
-rw-r--r--src/mesa/tnl/t_vb_program.c108
-rw-r--r--src/mesa/tnl/t_vb_render.c20
-rw-r--r--src/mesa/tnl/t_vb_texgen.c14
-rw-r--r--src/mesa/tnl/t_vb_texmat.c6
-rw-r--r--src/mesa/tnl/t_vb_vertex.c16
-rw-r--r--src/mesa/x86/gen_matypes.c4
23 files changed, 791 insertions, 683 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index f593169eef..0dec13c3ae 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.62 2002/01/12 03:01:23 brianp Exp $ */
+/* $Id: mtypes.h,v 1.63 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -24,6 +24,10 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/**
+ * \file mtypes.h
+ * \brief Main Mesa data structures.
+ */
#ifndef TYPES_H
#define TYPES_H
@@ -67,7 +71,7 @@
#endif
-/*
+/**
* Accumulation buffer data type:
*/
#if ACCUM_BITS==8
@@ -81,7 +85,7 @@
#endif
-/*
+/**
* Stencil buffer data type:
*/
#if STENCIL_BITS==8
@@ -95,20 +99,20 @@
#endif
-/*
+/**
* Depth buffer data type:
*/
typedef GLuint GLdepth; /* Must be 32-bits! */
-/*
+/**
* Fixed point data type:
*/
typedef int GLfixed;
-/*
+/**
* Some forward type declarations
*/
struct _mesa_HashTable;
@@ -120,7 +124,52 @@ typedef struct gl_frame_buffer GLframebuffer;
-/* Maximum number of temporary vertices required for clipping. (Used
+/* These define the aliases between numbered vertex attributes and
+ * conventional OpenGL vertex attributes. We use these values in
+ * quite a few places. New in Mesa 4.1.
+ */
+#define VERT_ATTRIB_POS 0
+#define VERT_ATTRIB_WEIGHT 1
+#define VERT_ATTRIB_NORMAL 2
+#define VERT_ATTRIB_COLOR0 3
+#define VERT_ATTRIB_COLOR1 4
+#define VERT_ATTRIB_FOG 5
+#define VERT_ATTRIB_SIX 6
+#define VERT_ATTRIB_SEVEN 7
+#define VERT_ATTRIB_TEX0 8
+#define VERT_ATTRIB_TEX1 9
+#define VERT_ATTRIB_TEX2 10
+#define VERT_ATTRIB_TEX3 11
+#define VERT_ATTRIB_TEX4 12
+#define VERT_ATTRIB_TEX5 13
+#define VERT_ATTRIB_TEX6 14
+#define VERT_ATTRIB_TEX7 15
+#define VERT_ATTRIB_MAX 16
+
+/* These are used in bitfields in many places */
+#define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
+#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
+#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
+#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
+#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
+#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
+#define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX)
+#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
+#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
+#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
+#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
+#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
+#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
+#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
+#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
+#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
+
+#define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u)))
+
+
+
+/**
+ * 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)
@@ -185,7 +234,7 @@ struct gl_shine_tab {
struct gl_light {
- struct gl_light *next; /* double linked list with sentinel */
+ struct gl_light *next; /* double linked list with sentinel */
struct gl_light *prev;
GLfloat Ambient[4]; /* ambient color */
@@ -295,27 +344,6 @@ struct gl_colorbuffer_attrib {
};
-/* These define the aliases between numbered vertex attributes and
- * conventional OpenGL vertex attributes.
- */
-#define VERT_ATTRIB_POS 0
-#define VERT_ATTRIB_WEIGHT 1
-#define VERT_ATTRIB_NORMAL 2
-#define VERT_ATTRIB_COLOR0 3
-#define VERT_ATTRIB_COLOR1 4
-#define VERT_ATTRIB_FOG 5
-#define VERT_ATTRIB_SIX 6
-#define VERT_ATTRIB_SEVEN 7
-#define VERT_ATTRIB_TEX0 8
-#define VERT_ATTRIB_TEX1 9
-#define VERT_ATTRIB_TEX2 10
-#define VERT_ATTRIB_TEX3 11
-#define VERT_ATTRIB_TEX4 12
-#define VERT_ATTRIB_TEX5 13
-#define VERT_ATTRIB_TEX6 14
-#define VERT_ATTRIB_TEX7 15
-#define VERT_ATTRIB_MAX 16
-
struct gl_current_attrib {
/* These values valid only when FLUSH_VERTICES has been called.
*/
@@ -1225,8 +1253,8 @@ struct vp_program
GLint ErrorPos; /* Position in string where error was detected */
GLint RefCount; /* Since programs can be shared among contexts */
GLboolean Resident;
- GLbitfield InputsRead; /* Bitmask of which input regs are read */
- GLbitfield OutputsWritten; /* Bitmask of which output regs are written to */
+ GLuint InputsRead; /* Bitmask of which input regs are read */
+ GLuint OutputsWritten; /* Bitmask of which output regs are written to */
};
@@ -1487,22 +1515,22 @@ struct matrix_stack
/* Bits to track array state changes (also used to summarize array enabled)
*/
-#define _NEW_ARRAY_VERTEX (1 << VERT_ATTRIB_POS)
-#define _NEW_ARRAY_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
-#define _NEW_ARRAY_NORMAL (1 << VERT_ATTRIB_NORMAL)
-#define _NEW_ARRAY_COLOR0 (1 << VERT_ATTRIB_COLOR0)
-#define _NEW_ARRAY_COLOR1 (1 << VERT_ATTRIB_COLOR1)
-#define _NEW_ARRAY_FOGCOORD (1 << VERT_ATTRIB_FOG)
-#define _NEW_ARRAY_INDEX (1 << VERT_ATTRIB_SIX)
-#define _NEW_ARRAY_EDGEFLAG (1 << VERT_ATTRIB_SEVEN)
-#define _NEW_ARRAY_TEXCOORD_0 (1 << VERT_ATTRIB_TEX0)
-#define _NEW_ARRAY_TEXCOORD_1 (1 << VERT_ATTRIB_TEX1)
-#define _NEW_ARRAY_TEXCOORD_2 (1 << VERT_ATTRIB_TEX2)
-#define _NEW_ARRAY_TEXCOORD_3 (1 << VERT_ATTRIB_TEX3)
-#define _NEW_ARRAY_TEXCOORD_4 (1 << VERT_ATTRIB_TEX4)
-#define _NEW_ARRAY_TEXCOORD_5 (1 << VERT_ATTRIB_TEX5)
-#define _NEW_ARRAY_TEXCOORD_6 (1 << VERT_ATTRIB_TEX6)
-#define _NEW_ARRAY_TEXCOORD_7 (1 << VERT_ATTRIB_TEX7)
+#define _NEW_ARRAY_VERTEX VERT_BIT_POS
+#define _NEW_ARRAY_WEIGHT VERT_BIT_WEIGHT
+#define _NEW_ARRAY_NORMAL VERT_BIT_NORMAL
+#define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0
+#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
+#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
+#define _NEW_ARRAY_INDEX VERT_BIT_SIX
+#define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN
+#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
+#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
+#define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2
+#define _NEW_ARRAY_TEXCOORD_3 VERT_BIT_TEX3
+#define _NEW_ARRAY_TEXCOORD_4 VERT_BIT_TEX4
+#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
+#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
+#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
#define _NEW_ARRAY_ALL 0xffff
#define _NEW_ARRAY_VERT_ATTRIB0 0x10000
@@ -1594,15 +1622,16 @@ struct gl_tnl_module {
};
-/*
- * The library context:
+/**
+ * This is the central context data structure for Mesa. Almost all
+ * OpenGL state is contained in this structure.
*/
struct __GLcontextRec {
- /*
- ** Os related interfaces; these *must* be the first members of this
- ** structure, because they are exposed to the outside world (i.e. GLX
- ** extension).
- */
+ /**
+ * OS related interfaces; these *must* be the first members of this
+ * structure, because they are exposed to the outside world (i.e. GLX
+ * extension).
+ */
__GLimports imports;
__GLexports exports;
@@ -1610,22 +1639,24 @@ struct __GLcontextRec {
struct gl_shared_state *Shared;
/* API function pointer tables */
- struct _glapi_table *Save; /* Display list save funcs */
- struct _glapi_table *Exec; /* Execute funcs */
- struct _glapi_table *CurrentDispatch; /* == Save or Exec !! */
+ struct _glapi_table *Save; /**< Display list save funcs */
+ struct _glapi_table *Exec; /**< Execute funcs */
+ struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */
- GLboolean ExecPrefersFloat; /* What preference for color conversion? */
+ GLboolean ExecPrefersFloat; /**< What preference for color conversion? */
GLboolean SavePrefersFloat;
GLvisual Visual;
- GLframebuffer *DrawBuffer; /* buffer for writing */
- GLframebuffer *ReadBuffer; /* buffer for reading */
+ GLframebuffer *DrawBuffer; /**< buffer for writing */
+ GLframebuffer *ReadBuffer; /**< buffer for reading */
- /* Driver function pointer table */
+ /**
+ * Device driver function pointer table
+ */
struct dd_function_table Driver;
- void *DriverCtx; /* Points to device driver context/state */
- void *DriverMgrCtx; /* Points to device driver manager (optional)*/
+ void *DriverCtx; /**< Points to device driver context/state */
+ void *DriverMgrCtx; /**< Points to device driver manager (optional)*/
/* Core/Driver constants */
struct gl_constants Const;
@@ -1726,22 +1757,22 @@ struct __GLcontextRec {
struct gl_list_extensions listext; /* driver dlist extensions */
- GLboolean OcclusionResult; /* GL_HP_occlusion_test */
- GLboolean OcclusionResultSaved; /* GL_HP_occlusion_test */
+ GLboolean OcclusionResult; /**< for GL_HP_occlusion_test */
+ GLboolean OcclusionResultSaved; /**< for GL_HP_occlusion_test */
/* Z buffer stuff */
- GLuint DepthMax; /* Max depth buffer value */
- GLfloat DepthMaxF; /* Float max depth buffer value */
- GLfloat MRD; /* minimum resolvable difference in Z values */
+ GLuint DepthMax; /**< Max depth buffer value */
+ GLfloat DepthMaxF; /**< Float max depth buffer value */
+ GLfloat MRD; /**< minimum resolvable difference in Z values */
- /* Should 3Dfx Glide driver catch signals? */
+ /** Should 3Dfx Glide driver catch signals? */
GLboolean CatchSignals;
- /* For debugging/development only */
+ /** For debugging/development only */
GLboolean NoRaster;
GLboolean FirstTimeCurrent;
- /* Dither disable via MESA_NO_DITHER env var */
+ /** Dither disable via MESA_NO_DITHER env var */
GLboolean NoDither;
GLboolean Rendering;
diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c
index 010efbdc5d..1187538c73 100644
--- a/src/mesa/tnl/t_array_api.c
+++ b/src/mesa/tnl/t_array_api.c
@@ -1,10 +1,10 @@
-/* $Id: t_array_api.c,v 1.23 2002/01/05 20:51:12 brianp Exp $ */
+/* $Id: t_array_api.c,v 1.24 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 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"),
@@ -22,9 +22,12 @@
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keithw@valinux.com>
+ */
+
+/**
+ * \file vpexec.c
+ * \brief Vertex array API functions (glDrawArrays, etc)
+ * \author Keith Whitwell
*/
#include "glheader.h"
@@ -100,7 +103,9 @@ static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode,
-
+/**
+ * Called via the GL API dispatcher.
+ */
void
_tnl_DrawArrays(GLenum mode, GLint start, GLsizei count)
{
@@ -232,6 +237,9 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count)
}
+/**
+ * Called via the GL API dispatcher.
+ */
void
_tnl_DrawRangeElements(GLenum mode,
GLuint start, GLuint end,
@@ -300,6 +308,9 @@ _tnl_DrawRangeElements(GLenum mode,
+/**
+ * Called via the GL API dispatcher.
+ */
void
_tnl_DrawElements(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices)
@@ -351,6 +362,10 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type,
}
+/**
+ * Initialize context's vertex array fields. Called during T 'n L context
+ * creation.
+ */
void _tnl_array_init( GLcontext *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -378,6 +393,10 @@ void _tnl_array_init( GLcontext *ctx )
}
+/**
+ * Destroy the context's vertex array stuff.
+ * Called during T 'n L context destruction.
+ */
void _tnl_array_destroy( GLcontext *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c
index 0b93cf9130..cec1b63239 100644
--- a/src/mesa/tnl/t_array_import.c
+++ b/src/mesa/tnl/t_array_import.c
@@ -1,4 +1,4 @@
-/* $Id: t_array_import.c,v 1.21 2002/01/06 03:54:12 brianp Exp $ */
+/* $Id: t_array_import.c,v 1.22 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -228,9 +228,12 @@ static void _tnl_import_edgeflag( GLcontext *ctx,
-/* Callback for VB stages that need to improve the quality of arrays
+/**
+ * Callback for VB stages that need to improve the quality of arrays
* bound to the VB. This is only necessary for client arrays which
* have not been transformed at any point in the pipeline.
+ * \param required - bitmask of VERT_*_BIT flags
+ * \param flags - bitmask of VEC_* flags (ex: VEC_NOT_WRITABLE)
*/
static void _tnl_upgrade_client_data( GLcontext *ctx,
GLuint required,
@@ -246,55 +249,55 @@ static void _tnl_upgrade_client_data( GLcontext *ctx,
if (writeable || stride) ca_flags |= CA_CLIENT_DATA;
- if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr)
- required |= VERT_OBJ_BIT;
+ if ((required & VERT_BIT_CLIP) && VB->ClipPtr == VB->ObjPtr)
+ required |= VERT_BIT_POS;
/* _tnl_print_vert_flags("_tnl_upgrade_client_data", required); */
- if ((required & VERT_OBJ_BIT) && (VB->ObjPtr->flags & flags)) {
+ if ((required & VERT_BIT_POS) && (VB->ObjPtr->flags & flags)) {
ASSERT(VB->ObjPtr == &inputs->Obj);
_tnl_import_vertex( ctx, writeable, stride );
- VB->importable_data &= ~(VERT_OBJ_BIT|VERT_CLIP);
+ VB->importable_data &= ~(VERT_BIT_POS|VERT_BIT_CLIP);
}
- if ((required & VERT_NORMAL_BIT) && (VB->NormalPtr->flags & flags)) {
+ if ((required & VERT_BIT_NORMAL) && (VB->NormalPtr->flags & flags)) {
ASSERT(VB->NormalPtr == &inputs->Normal);
_tnl_import_normal( ctx, writeable, stride );
- VB->importable_data &= ~VERT_NORMAL_BIT;
+ VB->importable_data &= ~VERT_BIT_NORMAL;
}
- if ((required & VERT_COLOR0_BIT) && (VB->ColorPtr[0]->Flags & ca_flags)) {
+ if ((required & VERT_BIT_COLOR0) && (VB->ColorPtr[0]->Flags & ca_flags)) {
ASSERT(VB->ColorPtr[0] == &inputs->Color);
_tnl_import_color( ctx, GL_FLOAT, writeable, stride );
- VB->importable_data &= ~VERT_COLOR0_BIT;
+ VB->importable_data &= ~VERT_BIT_COLOR0;
}
- if ((required & VERT_COLOR1_BIT) &&
+ if ((required & VERT_BIT_COLOR1) &&
(VB->SecondaryColorPtr[0]->Flags & ca_flags)) {
ASSERT(VB->SecondaryColorPtr[0] == &inputs->SecondaryColor);
_tnl_import_secondarycolor( ctx, GL_FLOAT, writeable, stride );
- VB->importable_data &= ~VERT_COLOR1_BIT;
+ VB->importable_data &= ~VERT_BIT_COLOR1;
}
- if ((required & VERT_FOG_BIT)
+ if ((required & VERT_BIT_FOG)
&& (VB->FogCoordPtr->flags & flags)) {
ASSERT(VB->FogCoordPtr == &inputs->FogCoord);
_tnl_import_fogcoord( ctx, writeable, stride );
- VB->importable_data &= ~VERT_FOG_BIT;
+ VB->importable_data &= ~VERT_BIT_FOG;
}
- if ((required & VERT_INDEX_BIT) && (VB->IndexPtr[0]->flags & flags)) {
+ if ((required & VERT_BIT_INDEX) && (VB->IndexPtr[0]->flags & flags)) {
ASSERT(VB->IndexPtr[0] == &inputs->Index);
_tnl_import_index( ctx, writeable, stride );
- VB->importable_data &= ~VERT_INDEX_BIT;
+ VB->importable_data &= ~VERT_BIT_INDEX;
}
- if (required & VERT_TEX_ANY)
+ if (required & VERT_BITS_TEX_ANY)
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
- if ((required & VERT_TEX(i)) && (VB->TexCoordPtr[i]->flags & flags)) {
+ if ((required & VERT_BIT_TEX(i)) && (VB->TexCoordPtr[i]->flags & flags)) {
ASSERT(VB->TexCoordPtr[i] == &inputs->TexCoord[i]);
_tnl_import_texcoord( ctx, i, writeable, stride );
- VB->importable_data &= ~VERT_TEX(i);
+ VB->importable_data &= ~VERT_BIT_TEX(i);
}
}
@@ -313,18 +316,18 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
/* start, count, ctx->Array.LockFirst, ctx->Array.LockCount); */
/* _tnl_print_vert_flags(" inputs", inputs); */
/* _tnl_print_vert_flags(" _Enabled", ctx->Array._Enabled); */
-/* _tnl_print_vert_flags(" importable", inputs & VERT_FIXUP); */
+/* _tnl_print_vert_flags(" importable", inputs & VERT_BITS_FIXUP); */
VB->Count = count - start;
VB->FirstClipped = VB->Count;
- VB->Elts = 0;
- VB->MaterialMask = 0;
- VB->Material = 0;
- VB->Flag = 0;
+ VB->Elts = NULL;
+ VB->MaterialMask = NULL;
+ VB->Material = NULL;
+ VB->Flag = NULL;
VB->Primitive = tnl->tmp_primitive;
VB->PrimitiveLength = tnl->tmp_primitive_length;
VB->import_data = _tnl_upgrade_client_data;
- VB->importable_data = inputs & VERT_FIXUP;
+ VB->importable_data = inputs & VERT_BITS_FIXUP;
if (ctx->Array.LockCount) {
ASSERT(start == (GLint) ctx->Array.LockFirst);
@@ -333,27 +336,27 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
_ac_import_range( ctx, start, count );
- if (inputs & VERT_OBJ_BIT) {
+ if (inputs & VERT_BIT_POS) {
_tnl_import_vertex( ctx, 0, 0 );
tmp->Obj.count = VB->Count;
VB->ObjPtr = &tmp->Obj;
}
- if (inputs & VERT_NORMAL_BIT) {
+ if (inputs & VERT_BIT_NORMAL) {
_tnl_import_normal( ctx, 0, 0 );
tmp->Normal.count = VB->Count;
VB->NormalPtr = &tmp->Normal;
}
- if (inputs & VERT_COLOR0_BIT) {
+ if (inputs & VERT_BIT_COLOR0) {
_tnl_import_color( ctx, 0, 0, 0 );
VB->ColorPtr[0] = &tmp->Color;
VB->ColorPtr[1] = 0;
}
- if (inputs & VERT_TEX_ANY) {
- for (i = 0; i < ctx->Const.MaxTextureUnits ; i++) {
- if (inputs & VERT_TEX(i)) {
+ if (inputs & VERT_BITS_TEX_ANY) {
+ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+ if (inputs & VERT_BIT_TEX(i)) {
_tnl_import_texcoord( ctx, i, 0, 0 );
tmp->TexCoord[i].count = VB->Count;
VB->TexCoordPtr[i] = &tmp->TexCoord[i];
@@ -361,31 +364,45 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
}
}
- if (inputs & (VERT_INDEX_BIT|VERT_FOG_BIT|VERT_EDGEFLAG_BIT|VERT_COLOR1_BIT)) {
- if (inputs & VERT_INDEX_BIT) {
+ if (inputs & (VERT_BIT_INDEX | VERT_BIT_FOG |
+ VERT_BIT_EDGEFLAG | VERT_BIT_COLOR1)) {
+ if (inputs & VERT_BIT_INDEX) {
_tnl_import_index( ctx, 0, 0 );
tmp->Index.count = VB->Count;
VB->IndexPtr[0] = &tmp->Index;
VB->IndexPtr[1] = 0;
}
- if (inputs & VERT_FOG_BIT) {
+ if (inputs & VERT_BIT_FOG) {
_tnl_import_fogcoord( ctx, 0, 0 );
tmp->FogCoord.count = VB->Count;
VB->FogCoordPtr = &tmp->FogCoord;
}
- if (inputs & VERT_EDGEFLAG_BIT) {
+ if (inputs & VERT_BIT_EDGEFLAG) {
_tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) );
VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag.data;
}
- if (inputs & VERT_COLOR1_BIT) {
+ if (inputs & VERT_BIT_COLOR1) {
_tnl_import_secondarycolor( ctx, 0, 0, 0 );
VB->SecondaryColorPtr[0] = &tmp->SecondaryColor;
VB->SecondaryColorPtr[1] = 0;
}
}
+
+ if (ctx->VertexProgram.Enabled) {
+ /* XXX lots of work to do here */
+
+ printf("bind vp arrays!\n");
+ VB->AttribPtr[VERT_ATTRIB_POS] = VB->ObjPtr;
+ printf(" data = %p\n", VB->ObjPtr->data);
+ printf(" stride = %d\n", VB->ObjPtr->stride);
+ printf(" size = %d\n", VB->ObjPtr->size);
+
+ VB->AttribPtr[VERT_ATTRIB_NORMAL] = VB->NormalPtr;
+ }
+
}
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 64abe88bb7..db0bd7a474 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -1,4 +1,4 @@
-/* $Id: t_context.h,v 1.36 2002/01/06 03:54:12 brianp Exp $ */
+/* $Id: t_context.h,v 1.37 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -22,9 +22,12 @@
* 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.
- *
- * Author:
- * Keith Whitwell <keithw@valinux.com>
+ */
+
+/**
+ * \file t_context.h
+ * \brief TnL module datatypes and definitions.
+ * \author Keith Whitwell
*/
#ifndef _T_CONTEXT_H
@@ -58,49 +61,36 @@
/* Flags to be added to the primitive enum in VB->Primitive.
*/
-#define PRIM_MODE_MASK 0xff /* Extract the actual primitive */
-#define PRIM_BEGIN 0x100 /* The prim starts here (not wrapped) */
-#define PRIM_END 0x200 /* The prim ends in this VB (does not wrap) */
-#define PRIM_PARITY 0x400 /* The prim wrapped on an odd number of verts */
-#define PRIM_LAST 0x800 /* No more prims in the VB */
+#define PRIM_MODE_MASK 0xff /* Extract the actual primitive */
+#define PRIM_BEGIN 0x100 /* The prim starts here (not wrapped) */
+#define PRIM_END 0x200 /* The prim ends in this VB (does not wrap) */
+#define PRIM_PARITY 0x400 /* The prim wrapped on an odd number of verts */
+#define PRIM_LAST 0x800 /* No more prims in the VB */
-/* Flags that describe the inputs and outputs of pipeline stages, and
- * the contents of a vertex-cassette.
- *
- * 5 spare flags, rearrangement of eval flags can secure at least 3
- * more.
+/**
+ * Flags that describe the inputs and outputs of pipeline stages, and
+ * the contents of a vertex-cassette. We reuse the VERT_BIT_* flags
+ * defined in mtypes.h and add a bunch of new ones.
*/
-#define VERT_OBJ_BIT _NEW_ARRAY_VERTEX
-#define VERT_WEIGHT_BIT _NEW_ARRAY_WEIGHT /* unused */
-#define VERT_NORMAL_BIT _NEW_ARRAY_NORMAL
-#define VERT_COLOR0_BIT _NEW_ARRAY_COLOR0
-#define VERT_COLOR1_BIT _NEW_ARRAY_COLOR1
-#define VERT_FOG_BIT _NEW_ARRAY_FOGCOORD
-#define VERT_INDEX_BIT _NEW_ARRAY_INDEX
-#define VERT_EDGEFLAG_BIT _NEW_ARRAY_EDGEFLAG
-#define VERT_TEX0_BIT _NEW_ARRAY_TEXCOORD_0
-#define VERT_TEX1_BIT _NEW_ARRAY_TEXCOORD_1
-#define VERT_TEX2_BIT _NEW_ARRAY_TEXCOORD_2
-#define VERT_TEX3_BIT _NEW_ARRAY_TEXCOORD_3
-#define VERT_TEX4_BIT _NEW_ARRAY_TEXCOORD_4
-#define VERT_TEX5_BIT _NEW_ARRAY_TEXCOORD_5
-#define VERT_TEX6_BIT _NEW_ARRAY_TEXCOORD_6
-#define VERT_TEX7_BIT _NEW_ARRAY_TEXCOORD_7
-#define VERT_EVAL_C1 0x10000 /* imm only */
-#define VERT_EVAL_C2 0x20000 /* imm only */
-#define VERT_EVAL_P1 0x40000 /* imm only */
-#define VERT_EVAL_P2 0x80000 /* imm only */
-#define VERT_OBJ_3 0x100000 /* imm only */
-#define VERT_OBJ_4 0x200000 /* imm only */
-#define VERT_MATERIAL 0x400000 /* imm only, but tested in vb code */
-#define VERT_ELT 0x800000 /* imm only */
-#define VERT_BEGIN 0x1000000 /* imm only, but tested in vb code */
-#define VERT_END 0x2000000 /* imm only, but tested in vb code */
-#define VERT_END_VB 0x4000000 /* imm only, but tested in vb code */
-#define VERT_POINT_SIZE 0x8000000 /* vb only, could reuse a bit */
-#define VERT_EYE VERT_BEGIN /* vb only, reuse imm bit */
-#define VERT_CLIP VERT_END /* vb only, reuse imm bit*/
+/* bits 0..5 defined in mtypes.h */
+#define VERT_BIT_INDEX VERT_BIT_SIX /* a free vertex attrib bit */
+#define VERT_BIT_EDGEFLAG VERT_BIT_SEVEN /* a free vertex attrib bit */
+/* bits 8..15 defined in mtypes.h */
+#define VERT_BIT_EVAL_C1 (1 << 16) /* imm only */
+#define VERT_BIT_EVAL_C2 (1 << 17) /* imm only */
+#define VERT_BIT_EVAL_P1 (1 << 18) /* imm only */
+#define VERT_BIT_EVAL_P2 (1 << 19) /* imm only */
+#define VERT_BIT_OBJ_3 (1 << 20) /* imm only */
+#define VERT_BIT_OBJ_4 (1 << 21) /* imm only */
+#define VERT_BIT_MATERIAL (1 << 22) /* imm only, but tested in vb code */
+#define VERT_BIT_ELT (1 << 23) /* imm only */
+#define VERT_BIT_BEGIN (1 << 24) /* imm only, but tested in vb code */
+#define VERT_BIT_END (1 << 25) /* imm only, but tested in vb code */
+#define VERT_BIT_END_VB (1 << 26) /* imm only, but tested in vb code */
+#define VERT_BIT_POINT_SIZE (1 << 27) /* vb only, could reuse a bit */
+#define VERT_BIT_EYE VERT_BIT_BEGIN /* vb only, reuse imm bit */
+#define VERT_BIT_CLIP VERT_BIT_END /* vb only, reuse imm bit*/
@@ -114,50 +104,47 @@
/* Shorthands.
*/
-#define VERT_EVAL_ANY (VERT_EVAL_C1 | VERT_EVAL_P1 | \
- VERT_EVAL_C2 | VERT_EVAL_P2)
-
-#define VERT_OBJ_23 (VERT_OBJ_3 | VERT_OBJ_BIT)
-#define VERT_OBJ_234 (VERT_OBJ_4 | VERT_OBJ_23)
-
-#define VERT_TEX0_BIT_SHIFT 11
-
-#define VERT_TEX(i) (VERT_TEX0_BIT << (i))
-
-#define VERT_TEX_ANY (VERT_TEX0_BIT | \
- VERT_TEX1_BIT | \
- VERT_TEX2_BIT | \
- VERT_TEX3_BIT | \
- VERT_TEX4_BIT | \
- VERT_TEX5_BIT | \
- VERT_TEX6_BIT | \
- VERT_TEX7_BIT)
-
-#define VERT_FIXUP (VERT_TEX_ANY | \
- VERT_COLOR0_BIT | \
- VERT_COLOR1_BIT | \
- VERT_FOG_BIT | \
- VERT_INDEX_BIT | \
- VERT_EDGEFLAG_BIT | \
- VERT_NORMAL_BIT)
-
-#define VERT_CURRENT_DATA (VERT_FIXUP | \
- VERT_MATERIAL)
-
-#define VERT_DATA (VERT_TEX_ANY | \
- VERT_COLOR0_BIT | \
- VERT_COLOR1_BIT | \
- VERT_FOG_BIT | \
- VERT_INDEX_BIT | \
- VERT_EDGEFLAG_BIT | \
- VERT_NORMAL_BIT | \
- VERT_OBJ_BIT | \
- VERT_MATERIAL | \
- VERT_ELT | \
- VERT_EVAL_ANY)
-
-
-/* KW: Represents everything that can take place between a begin and
+#define VERT_BITS_OBJ_23 (VERT_BIT_POS | VERT_BIT_OBJ_3)
+#define VERT_BITS_OBJ_234 (VERT_BIT_POS | VERT_BIT_OBJ_3 | VERT_BIT_OBJ_4)
+
+#define VERT_BITS_TEX_ANY (VERT_BIT_TEX0 | \
+ VERT_BIT_TEX1 | \
+ VERT_BIT_TEX2 | \
+ VERT_BIT_TEX3 | \
+ VERT_BIT_TEX4 | \
+ VERT_BIT_TEX5 | \
+ VERT_BIT_TEX6 | \
+ VERT_BIT_TEX7)
+
+#define VERT_BITS_EVAL_ANY (VERT_BIT_EVAL_C1 | VERT_BIT_EVAL_P1 | \
+ VERT_BIT_EVAL_C2 | VERT_BIT_EVAL_P2)
+
+#define VERT_BITS_FIXUP (VERT_BITS_TEX_ANY | \
+ VERT_BIT_COLOR0 | \
+ VERT_BIT_COLOR1 | \
+ VERT_BIT_FOG | \
+ VERT_BIT_INDEX | \
+ VERT_BIT_EDGEFLAG | \
+ VERT_BIT_NORMAL)
+
+#define VERT_BITS_CURRENT_DATA (VERT_BITS_FIXUP | \
+ VERT_BIT_MATERIAL)
+
+#define VERT_BITS_DATA (VERT_BITS_TEX_ANY | \
+ VERT_BIT_COLOR0 | \
+ VERT_BIT_COLOR1 | \
+ VERT_BIT_FOG | \
+ VERT_BIT_INDEX | \
+ VERT_BIT_EDGEFLAG | \
+ VERT_BIT_NORMAL | \
+ VERT_BIT_POS | \
+ VERT_BIT_MATERIAL | \
+ VERT_BIT_ELT | \
+ VERT_BITS_EVAL_ANY)
+
+
+/**
+ * KW: Represents everything that can take place between a begin and
* end, and can represent multiple begin/end pairs. Can be used to
* losslessly encode this information in display lists.
*/
@@ -202,9 +189,9 @@ struct immediate
GLuint MaterialOrMask;
GLuint MaterialAndMask;
- GLuint Primitive[IMM_SIZE]; /* BEGIN/END */
+ GLuint Primitive[IMM_SIZE]; /* BEGIN/END */
GLuint PrimitiveLength[IMM_SIZE]; /* BEGIN/END */
- GLuint Flag[IMM_SIZE]; /* VERT_* flags */
+ GLuint Flag[IMM_SIZE]; /* VERT_BIT_* flags */
/* All vertex attributes (position, normal, color, secondary color,
* texcoords, fog coord) are stored in the Attrib[] arrays instead
@@ -237,9 +224,8 @@ struct vertex_arrays
};
-typedef struct gl_material GLmaterial;
-
-/* Contains the current state of a running pipeline.
+/**
+ * Contains the current state of a running pipeline.
*/
typedef struct vertex_buffer
{
@@ -255,27 +241,27 @@ typedef struct vertex_buffer
/* Pointers to current data.
*/
- GLuint *Elts; /* VERT_ELT */
- GLvector4f *ObjPtr; /* VERT_OBJ_BIT */
- GLvector4f *EyePtr; /* VERT_EYE */
- GLvector4f *ClipPtr; /* VERT_CLIP */
- GLvector4f *NdcPtr; /* VERT_CLIP (2) */
- GLubyte ClipOrMask; /* VERT_CLIP (3) */
- GLubyte *ClipMask; /* VERT_CLIP (4) */
- GLvector4f *NormalPtr; /* VERT_NORMAL_BIT */
- GLfloat *NormalLengthPtr; /* VERT_NORMAL_BIT */
- GLboolean *EdgeFlag; /* VERT_EDGEFLAG_BIT */
+ GLuint *Elts; /* VERT_BIT_ELT */
+ GLvector4f *ObjPtr; /* VERT_BIT_POS */
+ GLvector4f *EyePtr; /* VERT_BIT_EYE */
+ GLvector4f *ClipPtr; /* VERT_BIT_CLIP */
+ GLvector4f *NdcPtr; /* VERT_BIT_CLIP (2) */
+ GLubyte ClipOrMask; /* VERT_BIT_CLIP (3) */
+ GLubyte *ClipMask; /* VERT_BIT_CLIP (4) */
+ GLvector4f *NormalPtr; /* VERT_BIT_NORMAL */
+ GLfloat *NormalLengthPtr; /* VERT_BIT_NORMAL */
+ GLboolean *EdgeFlag; /* VERT_BIT_EDGEFLAG */
GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; /* VERT_TEX_0..n */
- GLvector1ui *IndexPtr[2]; /* VERT_INDEX_BIT */
- struct gl_client_array *ColorPtr[2]; /* VERT_COLOR0_BIT */
- struct gl_client_array *SecondaryColorPtr[2];/* VERT_COLOR1_BIT */
- GLvector4f *PointSizePtr; /* VERT_POINT_SIZE */
- GLvector4f *FogCoordPtr; /* VERT_FOG_BIT */
- GLmaterial (*Material)[2]; /* VERT_MATERIAL, optional */
- GLuint *MaterialMask; /* VERT_MATERIAL, optional */
- GLuint *Flag; /* VERT_* flags, optional */
- GLuint *Primitive; /* GL_(mode)|PRIM_* flags */
- GLuint *PrimitiveLength; /* integers */
+ GLvector1ui *IndexPtr[2]; /* VERT_BIT_INDEX */
+ struct gl_client_array *ColorPtr[2]; /* VERT_BIT_COLOR0 */
+ struct gl_client_array *SecondaryColorPtr[2];/* VERT_BIT_COLOR1 */
+ GLvector4f *PointSizePtr; /* VERT_BIT_POINT_SIZE */
+ GLvector4f *FogCoordPtr; /* VERT_BIT_FOG */
+ struct gl_material (*Material)[2]; /* VERT_BIT_MATERIAL, optional */
+ GLuint *MaterialMask; /* VERT_BIT_MATERIAL, optional */
+ GLuint *Flag; /* VERT_BIT_* flags, optional */
+ GLuint *Primitive; /* GL_(mode)|PRIM_* flags */
+ GLuint *PrimitiveLength; /* integers */
/* Inputs to the vertex program stage */
GLvector4f *AttribPtr[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */
diff --git a/src/mesa/tnl/t_imm_api.c b/src/mesa/tnl/t_imm_api.c
index 48a8081c16..dd90dbe540 100644
--- a/src/mesa/tnl/t_imm_api.c
+++ b/src/mesa/tnl/t_imm_api.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_api.c,v 1.23 2002/01/05 20:51:13 brianp Exp $ */
+/* $Id: t_imm_api.c,v 1.24 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -123,7 +123,7 @@ _tnl_begin( GLcontext *ctx, GLenum p )
GLuint last = IM->LastPrimitive;
state |= (VERT_BEGIN_0|VERT_BEGIN_1);
- IM->Flag[count] |= VERT_BEGIN;
+ IM->Flag[count] |= VERT_BIT_BEGIN;
IM->Primitive[count] = p | PRIM_BEGIN;
IM->PrimitiveLength[IM->LastPrimitive] = count - IM->LastPrimitive;
IM->LastPrimitive = count;
@@ -249,7 +249,7 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p )
ASSERT (IM->FlushElt != FLUSH_ELT_EAGER);
IM->BeginState |= VERT_BEGIN_0|VERT_BEGIN_1;
- IM->Flag[IM->Count] |= VERT_BEGIN;
+ IM->Flag[IM->Count] |= VERT_BIT_BEGIN;
IM->Primitive[IM->Count] = p | PRIM_BEGIN;
IM->PrimitiveLength[IM->LastPrimitive] = IM->Count - IM->LastPrimitive;
IM->LastPrimitive = IM->Count;
@@ -293,7 +293,7 @@ _tnl_end( GLcontext *ctx )
GLuint last = IM->LastPrimitive;
state &= ~(VERT_BEGIN_0|VERT_BEGIN_1); /* update state */
- IM->Flag[count] |= VERT_END;
+ IM->Flag[count] |= VERT_BIT_END;
IM->Primitive[last] |= PRIM_END;
IM->PrimitiveLength[last] = count - last;
IM->Primitive[count] = PRIM_OUTSIDE_BEGIN_END; /* removes PRIM_BEGIN
@@ -339,7 +339,7 @@ _tnl_End(void)
GET_IMMEDIATE; \
GLuint count = IM->Count; \
GLfloat *color = IM->Attrib[VERT_ATTRIB_COLOR0][count]; \
- IM->Flag[count] |= VERT_COLOR0_BIT; \
+ IM->Flag[count] |= VERT_BIT_COLOR0; \
color[0] = r; \
color[1] = g; \
color[2] = b; \
@@ -414,7 +414,7 @@ _tnl_Color4ubv( const GLubyte *v)
GLuint count; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_COLOR1_BIT; \
+ IM->Flag[count] |= VERT_BIT_COLOR1; \
IM->Attrib[VERT_ATTRIB_COLOR1][count][0] = r; \
IM->Attrib[VERT_ATTRIB_COLOR1][count][1] = g; \
IM->Attrib[VERT_ATTRIB_COLOR1][count][2] = b; \
@@ -456,7 +456,7 @@ _tnl_EdgeFlag( GLboolean flag )
GET_IMMEDIATE;
count = IM->Count;
IM->EdgeFlag[count] = flag;
- IM->Flag[count] |= VERT_EDGEFLAG_BIT;
+ IM->Flag[count] |= VERT_BIT_EDGEFLAG;
}
@@ -467,7 +467,7 @@ _tnl_EdgeFlagv( const GLboolean *flag )
GET_IMMEDIATE;
count = IM->Count;
IM->EdgeFlag[count] = *flag;
- IM->Flag[count] |= VERT_EDGEFLAG_BIT;
+ IM->Flag[count] |= VERT_BIT_EDGEFLAG;
}
@@ -478,7 +478,7 @@ _tnl_FogCoordfEXT( GLfloat f )
GET_IMMEDIATE;
count = IM->Count;
IM->Attrib[VERT_ATTRIB_FOG][count][0] = f; /*FogCoord[count] = f;*/
- IM->Flag[count] |= VERT_FOG_BIT;
+ IM->Flag[count] |= VERT_BIT_FOG;
}
static void
@@ -488,7 +488,7 @@ _tnl_FogCoordfvEXT( const GLfloat *v )
GET_IMMEDIATE;
count = IM->Count;
IM->Attrib[VERT_ATTRIB_FOG][count][0] = v[0]; /*FogCoord[count] = v[0];*/
- IM->Flag[count] |= VERT_FOG_BIT;
+ IM->Flag[count] |= VERT_BIT_FOG;
}
@@ -499,7 +499,7 @@ _tnl_Indexi( GLint c )
GET_IMMEDIATE;
count = IM->Count;
IM->Index[count] = c;
- IM->Flag[count] |= VERT_INDEX_BIT;
+ IM->Flag[count] |= VERT_BIT_INDEX;
}
@@ -510,7 +510,7 @@ _tnl_Indexiv( const GLint *c )
GET_IMMEDIATE;
count = IM->Count;
IM->Index[count] = *c;
- IM->Flag[count] |= VERT_INDEX_BIT;
+ IM->Flag[count] |= VERT_BIT_INDEX;
}
@@ -520,7 +520,7 @@ _tnl_Indexiv( const GLint *c )
GLfloat *normal; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_NORMAL_BIT; \
+ IM->Flag[count] |= VERT_BIT_NORMAL; \
normal = IM->Attrib[VERT_ATTRIB_NORMAL][count]; \
ASSIGN_3V(normal, x,y,z); \
}
@@ -532,7 +532,7 @@ _tnl_Indexiv( const GLint *c )
fi_type *normal; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_NORMAL_BIT; \
+ IM->Flag[count] |= VERT_BIT_NORMAL; \
normal = (fi_type *)IM->Attrib[VERT_ATTRIB_NORMAL][count]; \
normal[0].i = ((fi_type *)&(x))->i; \
normal[1].i = ((fi_type *)&(y))->i; \
@@ -563,7 +563,7 @@ _tnl_Normal3fv( const GLfloat *v )
GLfloat *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_TEX0_BIT; \
+ IM->Flag[count] |= VERT_BIT_TEX0; \
tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \
ASSIGN_4V(tc,s,0,0,1); \
}
@@ -574,7 +574,7 @@ _tnl_Normal3fv( const GLfloat *v )
GLfloat *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_TEX0_BIT; \
+ IM->Flag[count] |= VERT_BIT_TEX0; \
tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \
ASSIGN_4V(tc, s, t, 0, 1); \
}
@@ -585,7 +585,7 @@ _tnl_Normal3fv( const GLfloat *v )
GLfloat *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_TEX0_BIT; \
+ IM->Flag[count] |= VERT_BIT_TEX0; \
IM->TexSize |= TEX_0_SIZE_3; \
tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \
ASSIGN_4V(tc, s, t, u, 1); \
@@ -597,7 +597,7 @@ _tnl_Normal3fv( const GLfloat *v )
GLfloat *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_TEX0_BIT; \
+ IM->Flag[count] |= VERT_BIT_TEX0; \
IM->TexSize |= TEX_0_SIZE_4; \
tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \
ASSIGN_4V(tc, s, t, u, v); \
@@ -610,7 +610,7 @@ _tnl_Normal3fv( const GLfloat *v )
fi_type *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
- IM->Flag[count] |= VERT_TEX0_BIT; \
+ IM->Flag[count] |= VERT_BIT_TEX0; \
tc = (fi_type *)IM->Attrib[VERT_ATTRIB_TEX0][count]; \
tc[0].i = ((fi_type *)&(s))->i; \
tc[1].i = ((fi_type *)&(t))->i; \
@@ -680,7 +680,7 @@ _tnl_TexCoord4fv( const GLfloat *v )
{ \
GLuint count = IM->Count++; \
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
- IM->Flag[count] |= VERT_OBJ_BIT; \
+ IM->Flag[count] |= VERT_BIT_POS; \
ASSIGN_4V(dest, x, y, 0, 1); \
/* ASSERT(IM->Flag[IM->Count]==0); */ \
if (count == IMM_MAXDATA - 1) \
@@ -691,7 +691,7 @@ _tnl_TexCoord4fv( const GLfloat *v )
{ \
GLuint count = IM->Count++; \
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
- IM->Flag[count] |= VERT_OBJ_23; \
+ IM->Flag[count] |= VERT_BITS_OBJ_23; \
ASSIGN_4V(dest, x, y, z, 1); \
/* ASSERT(IM->Flag[IM->Count]==0); */ \
if (count == IMM_MAXDATA - 1) \
@@ -702,7 +702,7 @@ _tnl_TexCoord4fv( const GLfloat *v )
{ \
GLuint count = IM->Count++; \
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
- IM->Flag[count] |= VERT_OBJ_234; \
+ IM->Flag[count] |= VERT_BITS_OBJ_234; \
ASSIGN_4V(dest, x, y, z, w); \
if (count == IMM_MAXDATA - 1) \
_tnl_flush_immediate( IM ); \
@@ -713,7 +713,7 @@ _tnl_TexCoord4fv( const GLfloat *v )
{ \
GLuint count = IM->Count++; \
fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \
- IM->Flag[count] |= VERT_OBJ_BIT; \
+ IM->Flag[count] |= VERT_BIT_POS; \
dest[0].i = ((fi_type *)&(x))->i; \
dest[1].i = ((fi_type *)&(y))->i; \
dest[2].i = 0; \
@@ -731,7 +731,7 @@ _tnl_TexCoord4fv( const GLfloat *v )
{ \
GLuint count = IM->Count++; \
fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \
- IM->Flag[count] |= VERT_OBJ_23; \
+ IM->Flag[count] |= VERT_BITS_OBJ_23; \
dest[0].i = ((fi_type *)&(x))->i; \
dest[1].i = ((fi_type *)&(y))->i; \
dest[2].i = ((fi_type *)&(z))->i; \
@@ -749,7 +749,7 @@ _tnl_TexCoord4fv( const GLfloat *v )
{ \
GLuint count = IM->Count++; \
fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \
- IM->Flag[count] |= VERT_OBJ_234; \
+ IM->Flag[count] |= VERT_BITS_OBJ_234; \
dest[0].i = ((fi_type *)&(x))->i; \
dest[1].i = ((fi_type *)&(y))->i; \
dest[2].i = ((fi_type *)&(z))->i; \
@@ -825,7 +825,7 @@ _tnl_Vertex4fv( const GLfloat *v )
GLuint count = IM->Count; \
GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \
ASSIGN_4V(tc, s, 0.0F, 0.0F, 1.0F); \
- IM->Flag[count] |= VERT_TEX(texunit); \
+ IM->Flag[count] |= VERT_BIT_TEX(texunit); \
} \
}
@@ -837,7 +837,7 @@ _tnl_Vertex4fv( const GLfloat *v )
GLuint count = IM->Count; \
GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \
ASSIGN_4V(tc, s, t, 0.0F, 1.0F); \
- IM->Flag[count] |= VERT_TEX(texunit); \
+ IM->Flag[count] |= VERT_BIT_TEX(texunit); \
} \
}
@@ -849,7 +849,7 @@ _tnl_Vertex4fv( const GLfloat *v )
GLuint count = IM->Count; \
GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \
ASSIGN_4V(tc, s, t, u, 1.0F); \
- IM->Flag[count] |= VERT_TEX(texunit); \
+ IM->Flag[count] |= VERT_BIT_TEX(texunit); \
IM->TexSize |= TEX_SIZE_3(texunit); \
} \
}
@@ -862,7 +862,7 @@ _tnl_Vertex4fv( const GLfloat *v )
GLuint count = IM->Count; \
GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \
ASSIGN_4V(tc, s, t, u, v); \
- IM->Flag[count] |= VERT_TEX(texunit); \
+ IM->Flag[count] |= VERT_BIT_TEX(texunit); \
IM->TexSize |= TEX_SIZE_4(texunit); \
} \
}
@@ -875,7 +875,7 @@ _tnl_Vertex4fv( const GLfloat *v )
if (texunit < IM->MaxTextureUnits) { \
GLuint count = IM->Count; \
fi_type *tc = (fi_type *)IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count];\
- IM->Flag[count] |= VERT_TEX(texunit); \
+ IM->Flag[count] |= VERT_BIT_TEX(texunit); \
tc[0].i = ((fi_type *)&(s))->i; \
tc[1].i = ((fi_type *)&(t))->i; \
tc[2].i = 0; \
@@ -946,7 +946,7 @@ _tnl_MultiTexCoord4fvARB(GLenum target, const GLfloat *v)
{ \
GLuint count = IM->Count++; \
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
- IM->Flag[count] |= VERT_EVAL_C1; \
+ IM->Flag[count] |= VERT_BIT_EVAL_C1; \
ASSIGN_4V(dest, x, 0, 0, 1); \
if (count == IMM_MAXDATA-1) \
_tnl_flush_immediate( IM ); \
@@ -956,7 +956,7 @@ _tnl_MultiTexCoord4fvARB(GLenum target, const GLfloat *v)
{ \
GLuint count = IM->Count++; \
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
- IM->Flag[count] |= VERT_EVAL_C2; \
+ IM->Flag[count] |= VERT_BIT_EVAL_C2; \
ASSIGN_4V(dest, x, y, 0, 1); \
if (count == IMM_MAXDATA-1) \
_tnl_flush_immediate( IM ); \
@@ -966,7 +966,7 @@ _tnl_MultiTexCoord4fvARB(GLenum target, const GLfloat *v)
{ \
GLuint count = IM->Count++; \
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
- IM->Flag[count] |= VERT_EVAL_P1; \
+ IM->Flag[count] |= VERT_BIT_EVAL_P1; \
ASSIGN_4V(dest, x, 0, 0, 1); \
if (count == IMM_MAXDATA-1) \
_tnl_flush_immediate( IM ); \
@@ -976,7 +976,7 @@ _tnl_MultiTexCoord4fvARB(GLenum target, const GLfloat *v)
{ \
GLuint count = IM->Count++; \
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
- IM->Flag[count] |= VERT_EVAL_P2; \
+ IM->Flag[count] |= VERT_BIT_EVAL_P2; \
ASSIGN_4V(dest, x, y, 0, 1); \
if (count == IMM_MAXDATA-1) \
_tnl_flush_immediate( IM ); \
@@ -1035,7 +1035,7 @@ _tnl_EvalPoint2( GLint i, GLint j )
GLuint count = IM->Count; \
IM->Elt[count] = i; \
IM->Flag[count] &= IM->ArrayEltFlags; \
- IM->Flag[count] |= VERT_ELT; \
+ IM->Flag[count] |= VERT_BIT_ELT; \
IM->FlushElt = IM->ArrayEltFlush; \
IM->Count += IM->ArrayEltIncr; \
if (IM->Count == IMM_MAXDATA) \
@@ -1162,10 +1162,10 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
if (bitmask == 0)
return;
- if (!(IM->Flag[count] & VERT_MATERIAL)) {
+ if (!(IM->Flag[count] & VERT_BIT_MATERIAL)) {
if (!IM->Material) {
- IM->Material = (GLmaterial (*)[2]) MALLOC( sizeof(GLmaterial) *
- IMM_SIZE * 2 );
+ IM->Material = (struct gl_material (*)[2])
+ MALLOC( sizeof(struct gl_material) * IMM_SIZE * 2 );
IM->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE );
IM->MaterialMask[IM->LastMaterial] = 0;
}
@@ -1175,7 +1175,7 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
IM->MaterialOrMask & ~bitmask );
}
- IM->Flag[count] |= VERT_MATERIAL;
+ IM->Flag[count] |= VERT_BIT_MATERIAL;
IM->MaterialMask[count] = 0;
IM->MaterialAndMask &= IM->MaterialMask[IM->LastMaterial];
IM->LastMaterial = count;
diff --git a/src/mesa/tnl/t_imm_debug.c b/src/mesa/tnl/t_imm_debug.c
index 0572d4c93c..ea57548505 100644
--- a/src/mesa/tnl/t_imm_debug.c
+++ b/src/mesa/tnl/t_imm_debug.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_debug.c,v 1.6 2002/01/05 20:51:13 brianp Exp $ */
+/* $Id: t_imm_debug.c,v 1.7 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -34,30 +34,30 @@ void _tnl_print_vert_flags( const char *name, GLuint flags )
"%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\n",
name,
flags,
- (flags & VERT_CLIP) ? "clip/proj-clip/glend, " : "",
- (flags & VERT_EDGEFLAG_BIT) ? "edgeflag, " : "",
- (flags & VERT_ELT) ? "array-elt, " : "",
- (flags & VERT_END_VB) ? "end-vb, " : "",
- (flags & VERT_EVAL_ANY) ? "eval-coord, " : "",
- (flags & VERT_EYE) ? "eye/glbegin, " : "",
- (flags & VERT_FOG_BIT) ? "fog-coord, " : "",
- (flags & VERT_INDEX_BIT) ? "index, " : "",
- (flags & VERT_MATERIAL) ? "material, " : "",
- (flags & VERT_NORMAL_BIT) ? "normals, " : "",
- (flags & VERT_OBJ_BIT) ? "obj, " : "",
- (flags & VERT_OBJ_3) ? "obj-3, " : "",
- (flags & VERT_OBJ_4) ? "obj-4, " : "",
- (flags & VERT_POINT_SIZE) ? "point-size, " : "",
- (flags & VERT_COLOR0_BIT) ? "colors, " : "",
- (flags & VERT_COLOR1_BIT) ? "specular, " : "",
- (flags & VERT_TEX0_BIT) ? "texcoord0, " : "",
- (flags & VERT_TEX1_BIT) ? "texcoord1, " : "",
- (flags & VERT_TEX2_BIT) ? "texcoord2, " : "",
- (flags & VERT_TEX3_BIT) ? "texcoord3, " : "",
- (flags & VERT_TEX4_BIT) ? "texcoord4, " : "",
- (flags & VERT_TEX5_BIT) ? "texcoord5, " : "",
- (flags & VERT_TEX6_BIT) ? "texcoord6, " : "",
- (flags & VERT_TEX7_BIT) ? "texcoord7, " : ""
+ (flags & VERT_BIT_CLIP) ? "clip/proj-clip/glend, " : "",
+ (flags & VERT_BIT_EDGEFLAG) ? "edgeflag, " : "",
+ (flags & VERT_BIT_ELT) ? "array-elt, " : "",
+ (flags & VERT_BIT_END_VB) ? "end-vb, " : "",
+ (flags & VERT_BITS_EVAL_ANY) ? "eval-coord, " : "",
+ (flags & VERT_BIT_EYE) ? "eye/glbegin, " : "",
+ (flags & VERT_BIT_FOG) ? "fog-coord, " : "",
+ (flags & VERT_BIT_INDEX) ? "index, " : "",
+ (flags & VERT_BIT_MATERIAL) ? "material, " : "",
+ (flags & VERT_BIT_NORMAL) ? "normals, " : "",
+ (flags & VERT_BIT_POS) ? "obj, " : "",
+ (flags & VERT_BIT_OBJ_3) ? "obj-3, " : "",
+ (flags & VERT_BIT_OBJ_4) ? "obj-4, " : "",
+ (flags & VERT_BIT_POINT_SIZE) ? "point-size, " : "",
+ (flags & VERT_BIT_COLOR0) ? "colors, " : "",
+ (flags & VERT_BIT_COLOR1) ? "specular, " : "",
+ (flags & VERT_BIT_TEX0) ? "texcoord0, " : "",
+ (flags & VERT_BIT_TEX1) ? "texcoord1, " : "",
+ (flags & VERT_BIT_TEX2) ? "texcoord2, " : "",
+ (flags & VERT_BIT_TEX3) ? "texcoord3, " : "",
+ (flags & VERT_BIT_TEX4) ? "texcoord4, " : "",
+ (flags & VERT_BIT_TEX5) ? "texcoord5, " : "",
+ (flags & VERT_BIT_TEX6) ? "texcoord6, " : "",
+ (flags & VERT_BIT_TEX7) ? "texcoord7, " : ""
);
}
@@ -89,22 +89,22 @@ void _tnl_print_cassette( struct immediate *IM )
for (i = IM->CopyStart ; i <= IM->Count ; i++) {
fprintf(stderr, "%u: ", i);
- if (req & VERT_OBJ_234) {
- if (flags[i] & VERT_EVAL_C1)
+ if (req & VERT_BITS_OBJ_234) {
+ if (flags[i] & VERT_BIT_EVAL_C1)
fprintf(stderr, "EvalCoord %f ",
IM->Attrib[VERT_ATTRIB_POS][i][0]);
- else if (flags[i] & VERT_EVAL_P1)
+ else if (flags[i] & VERT_BIT_EVAL_P1)
fprintf(stderr, "EvalPoint %.0f ",
IM->Attrib[VERT_ATTRIB_POS][i][0]);
- else if (flags[i] & VERT_EVAL_C2)
+ else if (flags[i] & VERT_BIT_EVAL_C2)
fprintf(stderr, "EvalCoord %f %f ",
IM->Attrib[VERT_ATTRIB_POS][i][0],
IM->Attrib[VERT_ATTRIB_POS][i][1]);
- else if (flags[i] & VERT_EVAL_P2)
+ else if (flags[i] & VERT_BIT_EVAL_P2)
fprintf(stderr, "EvalPoint %.0f %.0f ",
IM->Attrib[VERT_ATTRIB_POS][i][0],
IM->Attrib[VERT_ATTRIB_POS][i][1]);
- else if (i < IM->Count && (flags[i]&VERT_OBJ_234)) {
+ else if (i < IM->Count && (flags[i] & VERT_BITS_OBJ_234)) {
fprintf(stderr, "Obj %f %f %f %f",
IM->Attrib[VERT_ATTRIB_POS][i][0],
IM->Attrib[VERT_ATTRIB_POS][i][1],
@@ -113,19 +113,19 @@ void _tnl_print_cassette( struct immediate *IM )
}
}
- if (req & flags[i] & VERT_ELT)
+ if (req & flags[i] & VERT_BIT_ELT)
fprintf(stderr, " Elt %u\t", IM->Elt[i]);
- if (req & flags[i] & VERT_NORMAL_BIT)
+ if (req & flags[i] & VERT_BIT_NORMAL)
fprintf(stderr, " Norm %f %f %f ",
IM->Attrib[VERT_ATTRIB_NORMAL][i][0],
IM->Attrib[VERT_ATTRIB_NORMAL][i][1],
IM->Attrib[VERT_ATTRIB_NORMAL][i][2]);
- if (req & flags[i] & VERT_TEX_ANY) {
+ if (req & flags[i] & VERT_BITS_TEX_ANY) {
GLuint j;
for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) {
- if (req & flags[i] & VERT_TEX(j)) {
+ if (req & flags[i] & VERT_BIT_TEX(j)) {
fprintf(stderr, "TC%d %f %f %f %f", j,
IM->Attrib[VERT_ATTRIB_TEX0 + j][i][0],
IM->Attrib[VERT_ATTRIB_TEX0 + j][i][1],
@@ -135,39 +135,39 @@ void _tnl_print_cassette( struct immediate *IM )
}
}
- if (req & flags[i] & VERT_COLOR0_BIT)
+ if (req & flags[i] & VERT_BIT_COLOR0)
fprintf(stderr, " Rgba %f %f %f %f ",
IM->Attrib[VERT_ATTRIB_COLOR0][i][0],
IM->Attrib[VERT_ATTRIB_COLOR0][i][1],
IM->Attrib[VERT_ATTRIB_COLOR0][i][2],
IM->Attrib[VERT_ATTRIB_COLOR0][i][3]);
- if (req & flags[i] & VERT_COLOR1_BIT)
+ if (req & flags[i] & VERT_BIT_COLOR1)
fprintf(stderr, " Spec %f %f %f ",
IM->Attrib[VERT_ATTRIB_COLOR1][i][0],
IM->Attrib[VERT_ATTRIB_COLOR1][i][1],
IM->Attrib[VERT_ATTRIB_COLOR1][i][2]);
- if (req & flags[i] & VERT_FOG_BIT)
+ if (req & flags[i] & VERT_BIT_FOG)
fprintf(stderr, " Fog %f ", IM->Attrib[VERT_ATTRIB_FOG][i][0]);
- if (req & flags[i] & VERT_INDEX_BIT)
+ if (req & flags[i] & VERT_BIT_INDEX)
fprintf(stderr, " Index %u ", IM->Index[i]);
- if (req & flags[i] & VERT_EDGEFLAG_BIT)
+ if (req & flags[i] & VERT_BIT_EDGEFLAG)
fprintf(stderr, " Edgeflag %d ", IM->EdgeFlag[i]);
- if (req & flags[i] & VERT_MATERIAL)
+ if (req & flags[i] & VERT_BIT_MATERIAL)
fprintf(stderr, " Material ");
/* The order of these two is not easily knowable, but this is
* the usually correct way to look at them.
*/
- if (req & flags[i] & VERT_END)
+ if (req & flags[i] & VERT_BIT_END)
fprintf(stderr, " END ");
- if (req & flags[i] & VERT_BEGIN)
+ if (req & flags[i] & VERT_BIT_BEGIN)
fprintf(stderr, " BEGIN(%s) (%s%s%s%s)",
_mesa_prim_name[IM->Primitive[i] & PRIM_MODE_MASK],
(IM->Primitive[i] & PRIM_LAST) ? "LAST," : "",
diff --git a/src/mesa/tnl/t_imm_dlist.c b/src/mesa/tnl/t_imm_dlist.c
index 2ccf7a21bc..125dbc5ed6 100644
--- a/src/mesa/tnl/t_imm_dlist.c
+++ b/src/mesa/tnl/t_imm_dlist.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_dlist.c,v 1.36 2002/01/15 18:27:33 brianp Exp $ */
+/* $Id: t_imm_dlist.c,v 1.37 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -86,7 +86,7 @@ static void build_normal_lengths( struct immediate *IM )
for (i = 0 ; i < count ; ) {
dest[i] = len;
- if (flags[++i] & VERT_NORMAL_BIT) {
+ if (flags[++i] & VERT_BIT_NORMAL) {
len = (GLfloat) LEN_3FV( data[i] );
if (len > 0.0F) len = 1.0F / len;
}
@@ -108,7 +108,7 @@ static void fixup_normal_lengths( struct immediate *IM )
}
if (i < IM->Count) {
- while (!(flags[i] & (VERT_NORMAL_BIT|VERT_END_VB))) {
+ while (!(flags[i] & (VERT_BIT_NORMAL|VERT_BIT_END_VB))) {
dest[i] = len;
i++;
}
@@ -139,8 +139,8 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
* array-elements have been translated away by now, so it's ok to
* remove it.)
*/
- IM->OrFlag &= ~VERT_ELT;
- IM->AndFlag &= ~VERT_ELT;
+ IM->OrFlag &= ~VERT_BIT_ELT;
+ IM->AndFlag &= ~VERT_BIT_ELT;
_tnl_fixup_input( ctx, IM );
@@ -222,17 +222,17 @@ static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM )
_mesa_error( ctx, GL_INVALID_OPERATION, "glBegin/glEnd");
for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i])
- if (IM->Flag[i] & (VERT_BEGIN|VERT_END_VB))
+ if (IM->Flag[i] & (VERT_BIT_BEGIN|VERT_BIT_END_VB))
break;
/* Would like to just ignore vertices upto this point. Can't
* set copystart because it might skip materials?
*/
ASSERT(IM->Start == IM->CopyStart);
- if (i > IM->CopyStart || !(IM->Flag[IM->Start] & VERT_BEGIN)) {
+ if (i > IM->CopyStart || !(IM->Flag[IM->Start] & VERT_BIT_BEGIN)) {
IM->Primitive[IM->CopyStart] = GL_POLYGON+1;
IM->PrimitiveLength[IM->CopyStart] = i - IM->CopyStart;
- if (IM->Flag[i] & VERT_END_VB) {
+ if (IM->Flag[i] & VERT_BIT_END_VB) {
IM->Primitive[IM->CopyStart] |= PRIM_LAST;
IM->LastPrimitive = IM->CopyStart;
}
@@ -244,7 +244,7 @@ static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM )
_mesa_error( ctx, GL_INVALID_OPERATION, "glBegin/glEnd");
if (IM->CopyStart == IM->Start &&
- IM->Flag[IM->Start] & (VERT_END|VERT_END_VB))
+ IM->Flag[IM->Start] & (VERT_BIT_END | VERT_BIT_END_VB))
{
}
else
@@ -256,16 +256,16 @@ static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM )
/* one of these should be true, else we'll be in an infinite loop
*/
ASSERT(IM->PrimitiveLength[IM->Start] > 0 ||
- IM->Flag[IM->Start] & (VERT_END|VERT_END_VB));
+ IM->Flag[IM->Start] & (VERT_BIT_END | VERT_BIT_END_VB));
for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i])
- if (IM->Flag[i] & (VERT_END|VERT_END_VB)) {
+ if (IM->Flag[i] & (VERT_BIT_END | VERT_BIT_END_VB)) {
IM->PrimitiveLength[IM->CopyStart] = i - IM->CopyStart;
- if (IM->Flag[i] & VERT_END_VB) {
+ if (IM->Flag[i] & VERT_BIT_END_VB) {
IM->Primitive[IM->CopyStart] |= PRIM_LAST;
IM->LastPrimitive = IM->CopyStart;
}
- if (IM->Flag[i] & VERT_END) {
+ if (IM->Flag[i] & VERT_BIT_END) {
IM->Primitive[IM->CopyStart] |= PRIM_END;
}
break;
@@ -570,14 +570,14 @@ static void loopback_compiled_cassette( GLcontext *ctx, struct immediate *IM )
GLuint maxtex = 0;
GLuint p, length, prim = 0;
- if (orflag & VERT_OBJ_234)
+ if (orflag & VERT_BITS_OBJ_234)
vertex = (void (GLAPIENTRY *)(const GLfloat *)) glVertex4fv;
else
vertex = (void (GLAPIENTRY *)(const GLfloat *)) glVertex3fv;
- if (orflag & VERT_TEX_ANY) {
+ if (orflag & VERT_BITS_TEX_ANY) {
for (j = 0 ; j < ctx->Const.MaxTextureUnits ; j++) {
- if (orflag & VERT_TEX(j)) {
+ if (orflag & VERT_BIT_TEX(j)) {
maxtex = j+1;
if ((IM->TexSize & TEX_SIZE_4(j)) == TEX_SIZE_4(j))
texcoordfv[j] = glMultiTexCoord4fvARB;
@@ -601,47 +601,47 @@ static void loopback_compiled_cassette( GLcontext *ctx, struct immediate *IM )
}
for ( i = p ; i <= p+length ; i++) {
- if (flags[i] & VERT_TEX_ANY) {
+ if (flags[i] & VERT_BITS_TEX_ANY) {
GLuint k;
for (k = 0 ; k < maxtex ; k++) {
- if (flags[i] & VERT_TEX(k)) {
+ if (flags[i] & VERT_BIT_TEX(k)) {
texcoordfv[k]( GL_TEXTURE0_ARB + k,
IM->Attrib[VERT_ATTRIB_TEX0 + k][i] );
}
}
}
- if (flags[i] & VERT_NORMAL_BIT)
+ if (flags[i] & VERT_BIT_NORMAL)
glNormal3fv(IM->Attrib[VERT_ATTRIB_NORMAL][i]);
- if (flags[i] & VERT_COLOR0_BIT)
+ if (flags[i] & VERT_BIT_COLOR0)
glColor4fv( IM->Attrib[VERT_ATTRIB_COLOR0][i] );
- if (flags[i] & VERT_COLOR1_BIT)
+ if (flags[i] & VERT_BIT_COLOR1)
_glapi_Dispatch->SecondaryColor3fvEXT( IM->Attrib[VERT_ATTRIB_COLOR1][i] );
- if (flags[i] & VERT_FOG_BIT)
+ if (flags[i] & VERT_BIT_FOG)
_glapi_Dispatch->FogCoordfEXT( IM->Attrib[VERT_ATTRIB_FOG][i][0] );
- if (flags[i] & VERT_INDEX_BIT)
+ if (flags[i] & VERT_BIT_INDEX)
glIndexi( IM->Index[i] );
- if (flags[i] & VERT_EDGEFLAG_BIT)
+ if (flags[i] & VERT_BIT_EDGEFLAG)
glEdgeFlag( IM->EdgeFlag[i] );
- if (flags[i] & VERT_MATERIAL)
+ if (flags[i] & VERT_BIT_MATERIAL)
emit_material( IM->Material[i], IM->MaterialMask[i] );
- if (flags[i]&VERT_OBJ_234)
+ if (flags[i]&VERT_BITS_OBJ_234)
vertex( IM->Attrib[VERT_ATTRIB_POS][i] );
- else if (flags[i] & VERT_EVAL_C1)
+ else if (flags[i] & VERT_BIT_EVAL_C1)
glEvalCoord1f( IM->Attrib[VERT_ATTRIB_POS][i][0] );
- else if (flags[i] & VERT_EVAL_P1)
+ else if (flags[i] & VERT_BIT_EVAL_P1)
glEvalPoint1( (GLint) IM->Attrib[VERT_ATTRIB_POS][i][0] );
- else if (flags[i] & VERT_EVAL_C2)
+ else if (flags[i] & VERT_BIT_EVAL_C2)
glEvalCoord2f( IM->Attrib[VERT_ATTRIB_POS][i][0],
IM->Attrib[VERT_ATTRIB_POS][i][1] );
- else if (flags[i] & VERT_EVAL_P2)
+ else if (flags[i] & VERT_BIT_EVAL_P2)
glEvalPoint2( (GLint) IM->Attrib[VERT_ATTRIB_POS][i][0],
(GLint) IM->Attrib[VERT_ATTRIB_POS][i][1] );
}
diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c
index 83765025ea..ff01dc51bb 100644
--- a/src/mesa/tnl/t_imm_elt.c
+++ b/src/mesa/tnl/t_imm_elt.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_elt.c,v 1.15 2002/01/06 03:54:12 brianp Exp $ */
+/* $Id: t_imm_elt.c,v 1.16 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -138,7 +138,7 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES];
GLuint start, GLuint n
#define SRC_START 0
#define DST_START start
-#define CHECK if ((flags[i]&match) == VERT_ELT)
+#define CHECK if ((flags[i]&match) == VERT_BIT_ELT)
#define NEXT_F (void)1
#define NEXT_F2 f = first + elts[i] * stride;
@@ -760,63 +760,63 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM,
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
fprintf(stderr, "exec_array_elements %d .. %d\n", start, count);
- if (translate & VERT_OBJ_BIT) {
+ if (translate & VERT_BIT_POS) {
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_POS],
&ctx->Array.Vertex,
- flags, elts, (VERT_ELT|VERT_OBJ_BIT),
+ flags, elts, (VERT_BIT_ELT|VERT_BIT_POS),
start, count);
if (ctx->Array.Vertex.Size == 4)
- translate |= VERT_OBJ_234;
+ translate |= VERT_BITS_OBJ_234;
else if (ctx->Array.Vertex.Size == 3)
- translate |= VERT_OBJ_23;
+ translate |= VERT_BITS_OBJ_23;
}
- if (translate & VERT_NORMAL_BIT)
+ if (translate & VERT_BIT_NORMAL)
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_NORMAL],
&ctx->Array.Normal,
- flags, elts, (VERT_ELT|VERT_NORMAL_BIT),
+ flags, elts, (VERT_BIT_ELT|VERT_BIT_NORMAL),
start, count);
- if (translate & VERT_EDGEFLAG_BIT)
+ if (translate & VERT_BIT_EDGEFLAG)
_tnl_trans_elt_1ub( IM->EdgeFlag,
&ctx->Array.EdgeFlag,
- flags, elts, (VERT_ELT|VERT_EDGEFLAG_BIT),
+ flags, elts, (VERT_BIT_ELT|VERT_BIT_EDGEFLAG),
start, count);
- if (translate & VERT_COLOR0_BIT) {
+ if (translate & VERT_BIT_COLOR0) {
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR0],
&ctx->Array.Color,
- flags, elts, (VERT_ELT|VERT_COLOR0_BIT),
+ flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR0),
start, count);
}
- if (translate & VERT_COLOR1_BIT) {
+ if (translate & VERT_BIT_COLOR1) {
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR1],
&ctx->Array.SecondaryColor,
- flags, elts, (VERT_ELT|VERT_COLOR1_BIT),
+ flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR1),
start, count);
}
- if (translate & VERT_FOG_BIT)
+ if (translate & VERT_BIT_FOG)
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_FOG],
&ctx->Array.FogCoord,
- flags, elts, (VERT_ELT|VERT_FOG_BIT),
+ flags, elts, (VERT_BIT_ELT|VERT_BIT_FOG),
start, count);
- if (translate & VERT_INDEX_BIT)
+ if (translate & VERT_BIT_INDEX)
_tnl_trans_elt_1ui( IM->Index,
&ctx->Array.Index,
- flags, elts, (VERT_ELT|VERT_INDEX_BIT),
+ flags, elts, (VERT_BIT_ELT|VERT_BIT_INDEX),
start, count);
- if (translate & VERT_TEX_ANY) {
+ if (translate & VERT_BITS_TEX_ANY) {
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
- if (translate & VERT_TEX(i)) {
+ if (translate & VERT_BIT_TEX(i)) {
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i],
&ctx->Array.TexCoord[i],
- flags, elts, (VERT_ELT|VERT_TEX(i)),
+ flags, elts, (VERT_BIT_ELT|VERT_BIT_TEX(i)),
start, count);
if (ctx->Array.TexCoord[i].Size == 4)
@@ -827,7 +827,7 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM,
}
for (i = start ; i < count ; i++)
- if (flags[i] & VERT_ELT) flags[i] |= translate;
+ if (flags[i] & VERT_BIT_ELT) flags[i] |= translate;
IM->FlushElt = 0;
}
diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c
index 7eb3bee25d..01c886bec0 100644
--- a/src/mesa/tnl/t_imm_eval.c
+++ b/src/mesa/tnl/t_imm_eval.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_eval.c,v 1.20 2002/01/05 20:51:13 brianp Exp $ */
+/* $Id: t_imm_eval.c,v 1.21 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -52,11 +52,11 @@ static void eval_points1( GLfloat outcoord[][4],
GLfloat du, GLfloat u1 )
{
GLuint i;
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
- if (flags[i] & VERT_EVAL_ANY) {
+ for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++)
+ if (flags[i] & VERT_BITS_EVAL_ANY) {
outcoord[i][0] = coord[i][0];
outcoord[i][1] = coord[i][1];
- if (flags[i] & VERT_EVAL_P1)
+ if (flags[i] & VERT_BIT_EVAL_P1)
outcoord[i][0] = coord[i][0] * du + u1;
}
}
@@ -68,11 +68,11 @@ static void eval_points2( GLfloat outcoord[][4],
GLfloat dv, GLfloat v1 )
{
GLuint i;
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) {
- if (flags[i] & VERT_EVAL_ANY) {
+ for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) {
+ if (flags[i] & VERT_BITS_EVAL_ANY) {
outcoord[i][0] = coord[i][0];
outcoord[i][1] = coord[i][1];
- if (flags[i] & VERT_EVAL_P2) {
+ if (flags[i] & VERT_BIT_EVAL_P2) {
outcoord[i][0] = coord[i][0] * du + u1;
outcoord[i][1] = coord[i][1] * dv + v1;
}
@@ -100,8 +100,8 @@ static void eval1_4f( GLvector4f *dest,
GLfloat (*to)[4] = dest->data;
GLuint i;
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
- if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
+ for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++)
+ if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) {
GLfloat u = (coord[i][0] - u1) * du;
ASSIGN_4V(to[i], 0,0,0,1);
_math_horner_bezier_curve(map->Points, to[i], u,
@@ -126,8 +126,8 @@ static void eval1_4f_ca( struct gl_client_array *dest,
ASSERT(dest->Type == GL_FLOAT);
ASSERT(dest->StrideB == 4 * sizeof(GLfloat));
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
- if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
+ for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++)
+ if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) {
GLfloat u = (coord[i][0] - u1) * du;
ASSIGN_4V(to[i], 0,0,0,1);
_math_horner_bezier_curve(map->Points, to[i], u,
@@ -148,8 +148,8 @@ static void eval1_1ui( GLvector1ui *dest,
GLuint *to = dest->data;
GLuint i;
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
- if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
+ for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++)
+ if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) {
GLfloat u = (coord[i][0] - u1) * du;
GLfloat tmp;
_math_horner_bezier_curve(map->Points, &tmp, u, 1, map->Order);
@@ -168,8 +168,8 @@ static void eval1_norm( GLvector4f *dest,
GLfloat (*to)[4] = dest->data;
GLuint i;
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
- if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
+ for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++)
+ if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) {
GLfloat u = (coord[i][0] - u1) * du;
_math_horner_bezier_curve(map->Points, to[i], u, 3, map->Order);
}
@@ -196,8 +196,8 @@ static void eval2_obj_norm( GLvector4f *obj_ptr,
/* fprintf(stderr, "%s\n", __FUNCTION__); */
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
- if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
+ for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++)
+ if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) {
GLfloat u = (coord[i][0] - u1) * du;
GLfloat v = (coord[i][1] - v1) * dv;
GLfloat du[4], dv[4];
@@ -238,8 +238,8 @@ static void eval2_4f( GLvector4f *dest,
GLfloat (*to)[4] = dest->data;
GLuint i;
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
- if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
+ for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++)
+ if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) {
GLfloat u = (coord[i][0] - u1) * du;
GLfloat v = (coord[i][1] - v1) * dv;
/* fprintf(stderr, "coord %d: %f %f\n", i, coord[i][0], coord[i][1]); */
@@ -268,8 +268,8 @@ static void eval2_4f_ca( struct gl_client_array *dest,
ASSERT(dest->Type == GL_FLOAT);
ASSERT(dest->StrideB == 4 * sizeof(GLfloat));
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
- if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
+ for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++)
+ if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) {
GLfloat u = (coord[i][0] - u1) * du;
GLfloat v = (coord[i][1] - v1) * dv;
_math_horner_bezier_surf(map->Points, to[i], u, v, dimension,
@@ -292,8 +292,8 @@ static void eval2_norm( GLvector4f *dest,
GLfloat (*to)[4] = dest->data;
GLuint i;
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) {
- if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
+ for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) {
+ if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) {
GLfloat u = (coord[i][0] - u1) * du;
GLfloat v = (coord[i][1] - v1) * dv;
_math_horner_bezier_surf(map->Points, to[i], u, v, 3,
@@ -315,8 +315,8 @@ static void eval2_1ui( GLvector1ui *dest,
GLuint *to = dest->data;
GLuint i;
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
- if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
+ for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++)
+ if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) {
GLfloat u = (coord[i][0] - u1) * du;
GLfloat v = (coord[i][1] - v1) * dv;
GLfloat tmp;
@@ -379,52 +379,52 @@ static void update_eval( GLcontext *ctx )
GLuint eval1 = 0, eval2 = 0;
if (ctx->Eval.Map1Index)
- eval1 |= VERT_INDEX_BIT;
+ eval1 |= VERT_BIT_INDEX;
if (ctx->Eval.Map2Index)
- eval2 |= VERT_INDEX_BIT;
+ eval2 |= VERT_BIT_INDEX;
if (ctx->Eval.Map1Color4)
- eval1 |= VERT_COLOR0_BIT;
+ eval1 |= VERT_BIT_COLOR0;
if (ctx->Eval.Map2Color4)
- eval2 |= VERT_COLOR0_BIT;
+ eval2 |= VERT_BIT_COLOR0;
if (ctx->Eval.Map1Normal)
- eval1 |= VERT_NORMAL_BIT;
+ eval1 |= VERT_BIT_NORMAL;
if (ctx->Eval.Map2Normal)
- eval2 |= VERT_NORMAL_BIT;
+ eval2 |= VERT_BIT_NORMAL;
if (ctx->Eval.Map1TextureCoord4 ||
ctx->Eval.Map1TextureCoord3 ||
ctx->Eval.Map1TextureCoord2 ||
ctx->Eval.Map1TextureCoord1)
- eval1 |= VERT_TEX0_BIT;
+ eval1 |= VERT_BIT_TEX0;
if (ctx->Eval.Map2TextureCoord4 ||
ctx->Eval.Map2TextureCoord3 ||
ctx->Eval.Map2TextureCoord2 ||
ctx->Eval.Map2TextureCoord1)
- eval2 |= VERT_TEX0_BIT;
+ eval2 |= VERT_BIT_TEX0;
if (ctx->Eval.Map1Vertex4)
- eval1 |= VERT_OBJ_234;
+ eval1 |= VERT_BITS_OBJ_234;
if (ctx->Eval.Map1Vertex3)
- eval1 |= VERT_OBJ_23;
+ eval1 |= VERT_BITS_OBJ_23;
if (ctx->Eval.Map2Vertex4) {
if (ctx->Eval.AutoNormal)
- eval2 |= VERT_OBJ_234 | VERT_NORMAL_BIT;
+ eval2 |= VERT_BITS_OBJ_234 | VERT_BIT_NORMAL;
else
- eval2 |= VERT_OBJ_234;
+ eval2 |= VERT_BITS_OBJ_234;
}
else if (ctx->Eval.Map2Vertex3) {
if (ctx->Eval.AutoNormal)
- eval2 |= VERT_OBJ_23 | VERT_NORMAL_BIT;
+ eval2 |= VERT_BITS_OBJ_23 | VERT_BIT_NORMAL;
else
- eval2 |= VERT_OBJ_23;
+ eval2 |= VERT_BITS_OBJ_23;
}
tnl->eval.EvalMap1Flags = eval1;
@@ -448,13 +448,13 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
GLuint *flags = IM->Flag + IM->CopyStart;
GLuint copycount;
GLuint orflag = IM->OrFlag;
- GLuint any_eval1 = orflag & (VERT_EVAL_C1|VERT_EVAL_P1);
- GLuint any_eval2 = orflag & (VERT_EVAL_C2|VERT_EVAL_P2);
+ GLuint any_eval1 = orflag & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1);
+ GLuint any_eval2 = orflag & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2);
GLuint req = 0;
GLuint purge_flags = 0;
GLfloat (*coord)[4] = IM->Attrib[VERT_ATTRIB_POS] + IM->CopyStart;
- if (IM->AndFlag & VERT_EVAL_ANY)
+ if (IM->AndFlag & VERT_BITS_EVAL_ANY)
copycount = IM->Start - IM->CopyStart; /* just copy copied vertices */
else
copycount = IM->Count - IM->CopyStart; /* copy all vertices */
@@ -472,9 +472,9 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
req |= tnl->pipeline.inputs & tnl->eval.EvalMap1Flags;
if (!ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3)
- purge_flags = (VERT_EVAL_P1|VERT_EVAL_C1);
+ purge_flags = (VERT_BIT_EVAL_P1|VERT_BIT_EVAL_C1);
- if (orflag & VERT_EVAL_P1) {
+ if (orflag & VERT_BIT_EVAL_P1) {
eval_points1( store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart,
coord, flags,
ctx->Eval.MapGrid1du,
@@ -488,9 +488,9 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
req |= tnl->pipeline.inputs & tnl->eval.EvalMap2Flags;
if (!ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3)
- purge_flags |= (VERT_EVAL_P2|VERT_EVAL_C2);
+ purge_flags |= (VERT_BIT_EVAL_P2|VERT_BIT_EVAL_C2);
- if (orflag & VERT_EVAL_P2) {
+ if (orflag & VERT_BIT_EVAL_P2) {
eval_points2( store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart,
coord, flags,
ctx->Eval.MapGrid2du,
@@ -507,7 +507,7 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
/* Perform the evaluations on active data elements.
*/
- if (req & VERT_INDEX_BIT)
+ if (req & VERT_BIT_INDEX)
{
GLuint generated = 0;
@@ -519,16 +519,16 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
if (ctx->Eval.Map1Index && any_eval1) {
eval1_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map1Index );
- generated |= VERT_EVAL_C1|VERT_EVAL_P1;
+ generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1;
}
if (ctx->Eval.Map2Index && any_eval2) {
eval2_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map2Index );
- generated |= VERT_EVAL_C2|VERT_EVAL_P2;
+ generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2;
}
}
- if (req & VERT_COLOR0_BIT)
+ if (req & VERT_BIT_COLOR0)
{
GLuint generated = 0;
@@ -541,21 +541,21 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
tmp->Color.Ptr = store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart;
tmp->Color.StrideB = 4 * sizeof(GLfloat);
tmp->Color.Flags = 0;
- tnl->vb.importable_data &= ~VERT_COLOR0_BIT;
+ tnl->vb.importable_data &= ~VERT_BIT_COLOR0;
if (ctx->Eval.Map1Color4 && any_eval1) {
eval1_4f_ca( &tmp->Color, coord, flags, 4, &ctx->EvalMap.Map1Color4 );
- generated |= VERT_EVAL_C1|VERT_EVAL_P1;
+ generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1;
}
if (ctx->Eval.Map2Color4 && any_eval2) {
eval2_4f_ca( &tmp->Color, coord, flags, 4, &ctx->EvalMap.Map2Color4 );
- generated |= VERT_EVAL_C2|VERT_EVAL_P2;
+ generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2;
}
}
- if (req & VERT_TEX(0))
+ if (req & VERT_BIT_TEX(0))
{
GLuint generated = 0;
@@ -572,22 +572,22 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
if (ctx->Eval.Map1TextureCoord4) {
eval1_4f( &tmp->TexCoord[0], coord, flags, 4,
&ctx->EvalMap.Map1Texture4 );
- generated |= VERT_EVAL_C1|VERT_EVAL_P1;
+ generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1;
}
else if (ctx->Eval.Map1TextureCoord3) {
eval1_4f( &tmp->TexCoord[0], coord, flags, 3,
&ctx->EvalMap.Map1Texture3 );
- generated |= VERT_EVAL_C1|VERT_EVAL_P1;
+ generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1;
}
else if (ctx->Eval.Map1TextureCoord2) {
eval1_4f( &tmp->TexCoord[0], coord, flags, 2,
&ctx->EvalMap.Map1Texture2 );
- generated |= VERT_EVAL_C1|VERT_EVAL_P1;
+ generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1;
}
else if (ctx->Eval.Map1TextureCoord1) {
eval1_4f( &tmp->TexCoord[0], coord, flags, 1,
&ctx->EvalMap.Map1Texture1 );
- generated |= VERT_EVAL_C1|VERT_EVAL_P1;
+ generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1;
}
}
@@ -595,28 +595,28 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
if (ctx->Eval.Map2TextureCoord4) {
eval2_4f( &tmp->TexCoord[0], coord, flags, 4,
&ctx->EvalMap.Map2Texture4 );
- generated |= VERT_EVAL_C2|VERT_EVAL_P2;
+ generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2;
}
else if (ctx->Eval.Map2TextureCoord3) {
eval2_4f( &tmp->TexCoord[0], coord, flags, 3,
&ctx->EvalMap.Map2Texture3 );
- generated |= VERT_EVAL_C2|VERT_EVAL_P2;
+ generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2;
}
else if (ctx->Eval.Map2TextureCoord2) {
eval2_4f( &tmp->TexCoord[0], coord, flags, 2,
&ctx->EvalMap.Map2Texture2 );
- generated |= VERT_EVAL_C2|VERT_EVAL_P2;
+ generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2;
}
else if (ctx->Eval.Map2TextureCoord1) {
eval2_4f( &tmp->TexCoord[0], coord, flags, 1,
&ctx->EvalMap.Map2Texture1 );
- generated |= VERT_EVAL_C2|VERT_EVAL_P2;
+ generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2;
}
}
}
- if (req & VERT_NORMAL_BIT)
+ if (req & VERT_BIT_NORMAL)
{
GLuint generated = 0;
@@ -631,12 +631,12 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
if (ctx->Eval.Map1Normal && any_eval1) {
eval1_norm( &tmp->Normal, coord, flags, &ctx->EvalMap.Map1Normal );
- generated |= VERT_EVAL_C1|VERT_EVAL_P1;
+ generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1;
}
if (ctx->Eval.Map2Normal && any_eval2) {
eval2_norm( &tmp->Normal, coord, flags, &ctx->EvalMap.Map2Normal );
- generated |= VERT_EVAL_C2|VERT_EVAL_P2;
+ generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2;
}
}
@@ -645,7 +645,7 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
/* In the AutoNormal case, the copy and assignment of tmp->NormalPtr
* are done above.
*/
- if (req & VERT_OBJ_BIT)
+ if (req & VERT_BIT_POS)
{
if (copycount) {
/* This copy may already have occurred when eliminating
@@ -679,7 +679,7 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
if (any_eval2) {
if (ctx->Eval.Map2Vertex4) {
- if (ctx->Eval.AutoNormal && (req & VERT_NORMAL_BIT))
+ if (ctx->Eval.AutoNormal && (req & VERT_BIT_NORMAL))
eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 4,
&ctx->EvalMap.Map2Vertex4 );
else
@@ -687,7 +687,7 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
&ctx->EvalMap.Map2Vertex4 );
}
else if (ctx->Eval.Map2Vertex3) {
- if (ctx->Eval.AutoNormal && (req & VERT_NORMAL_BIT))
+ if (ctx->Eval.AutoNormal && (req & VERT_BIT_NORMAL))
eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 3,
&ctx->EvalMap.Map2Vertex3 );
else
@@ -704,7 +704,7 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
* must be ignored.
*/
if (purge_flags) {
- GLuint vertex = VERT_OBJ_BIT|(VERT_EVAL_ANY & ~purge_flags);
+ GLuint vertex = VERT_BIT_POS|(VERT_BITS_EVAL_ANY & ~purge_flags);
GLuint last_new_prim = 0;
GLuint new_prim_length = 0;
GLuint next_old_prim = 0;
diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c
index 8df863875a..056df78d0a 100644
--- a/src/mesa/tnl/t_imm_exec.c
+++ b/src/mesa/tnl/t_imm_exec.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_exec.c,v 1.34 2002/01/06 03:54:12 brianp Exp $ */
+/* $Id: t_imm_exec.c,v 1.35 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -22,11 +22,13 @@
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keithw@valinux.com>
*/
+/**
+ * \file vpexec.c
+ * \brief Setup to execute immediate-mode vertex data.
+ * \author Keith Whitwell
+ */
#include "glheader.h"
#include "colormac.h"
@@ -118,7 +120,7 @@ void _tnl_reset_compile_input( GLcontext *ctx,
}
-/*
+/**
* Copy the last specified normal, color, texcoord, edge flag, etc
* from the immediate struct into the ctx->Current attribute group.
*/
@@ -128,20 +130,20 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
_tnl_print_vert_flags("copy to current", flag);
- /* XXX should be able t replace these conditions with a loop over
+ /* XXX should be able to replace these conditions with a loop over
* the 16 vertex attributes.
*/
- if (flag & VERT_NORMAL_BIT)
+ if (flag & VERT_BIT_NORMAL)
COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_NORMAL],
IM->Attrib[VERT_ATTRIB_NORMAL][count]);
- if (flag & VERT_INDEX_BIT)
+ if (flag & VERT_BIT_INDEX)
ctx->Current.Index = IM->Index[count];
- if (flag & VERT_EDGEFLAG_BIT)
+ if (flag & VERT_BIT_EDGEFLAG)
ctx->Current.EdgeFlag = IM->EdgeFlag[count];
- if (flag & VERT_COLOR0_BIT) {
+ if (flag & VERT_BIT_COLOR0) {
COPY_4FV(ctx->Current.Attrib[VERT_ATTRIB_COLOR0],
IM->Attrib[VERT_ATTRIB_COLOR0][count]);
if (ctx->Light.ColorMaterialEnabled) {
@@ -151,24 +153,24 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
}
}
- if (flag & VERT_COLOR1_BIT)
+ if (flag & VERT_BIT_COLOR1)
COPY_4FV(ctx->Current.Attrib[VERT_ATTRIB_COLOR1],
IM->Attrib[VERT_ATTRIB_COLOR1][count]);
- if (flag & VERT_FOG_BIT)
+ if (flag & VERT_BIT_FOG)
ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = IM->Attrib[VERT_ATTRIB_FOG][count][0];
- if (flag & VERT_TEX_ANY) {
+ if (flag & VERT_BITS_TEX_ANY) {
GLuint i;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
- if (flag & VERT_TEX(i)) {
+ if (flag & VERT_BIT_TEX(i)) {
COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i],
IM->Attrib[VERT_ATTRIB_TEX0 + i][count]);
}
}
}
- if (flag & VERT_MATERIAL) {
+ if (flag & VERT_BIT_MATERIAL) {
_mesa_update_material( ctx,
IM->Material[IM->LastMaterial],
IM->MaterialOrMask );
@@ -202,12 +204,12 @@ void _tnl_compute_orflag( struct immediate *IM, GLuint start )
* eg. a single glMaterial call, in which case IM->Start ==
* IM->Count, but the buffer is definitely not empty.
*/
- if (IM->Flag[i] & VERT_DATA) {
+ if (IM->Flag[i] & VERT_BITS_DATA) {
IM->LastData++;
orflag |= IM->Flag[i];
}
- IM->Flag[IM->LastData+1] |= VERT_END_VB;
+ IM->Flag[IM->LastData+1] |= VERT_BIT_END_VB;
IM->CopyAndFlag = IM->AndFlag = andflag;
IM->OrFlag = orflag;
IM->CopyOrFlag = orflag;
@@ -215,7 +217,7 @@ void _tnl_compute_orflag( struct immediate *IM, GLuint start )
}
-/*
+/**
* This is where the vertex data is transfered from the 'struct immediate
* into the 'struct vertex_buffer'.
*
@@ -241,7 +243,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
*/
VB->Count = count;
VB->FirstClipped = IMM_MAXDATA - IM->CopyStart;
- VB->import_data = 0;
+ VB->import_data = NULL;
VB->importable_data = 0;
/* Need an IM->FirstPrimitive?
@@ -254,18 +256,18 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
/* TexCoordPtr's are zeroed in loop below.
*/
- VB->NormalPtr = 0;
- VB->NormalLengthPtr = 0;
- VB->EdgeFlag = 0;
- VB->IndexPtr[0] = 0;
- VB->IndexPtr[1] = 0;
- VB->ColorPtr[0] = 0;
- VB->ColorPtr[1] = 0;
- VB->SecondaryColorPtr[0] = 0;
- VB->SecondaryColorPtr[1] = 0;
- VB->Elts = 0;
- VB->MaterialMask = 0;
- VB->Material = 0;
+ VB->NormalPtr = NULL;
+ VB->NormalLengthPtr = NULL;
+ VB->EdgeFlag = NULL;
+ VB->IndexPtr[0] = NULL;
+ VB->IndexPtr[1] = NULL;
+ VB->ColorPtr[0] = NULL;
+ VB->ColorPtr[1] = NULL;
+ VB->SecondaryColorPtr[0] = NULL;
+ VB->SecondaryColorPtr[1] = NULL;
+ VB->Elts = NULL;
+ VB->MaterialMask = NULL;
+ VB->Material = NULL;
/* _tnl_print_vert_flags("copy-orflag", IM->CopyOrFlag); */
/* _tnl_print_vert_flags("orflag", IM->OrFlag); */
@@ -273,20 +275,20 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
/* Setup the initial values of array pointers in the vb.
*/
- if (inputs & VERT_OBJ_BIT) {
+ if (inputs & VERT_BIT_POS) {
tmp->Obj.data = IM->Attrib[VERT_ATTRIB_POS] + start;
tmp->Obj.start = (GLfloat *)(IM->Attrib[VERT_ATTRIB_POS] + start);
tmp->Obj.count = count;
VB->ObjPtr = &tmp->Obj;
- if ((IM->CopyOrFlag & VERT_OBJ_234) == VERT_OBJ_234)
+ if ((IM->CopyOrFlag & VERT_BITS_OBJ_234) == VERT_BITS_OBJ_234)
tmp->Obj.size = 4;
- else if ((IM->CopyOrFlag & VERT_OBJ_234) == VERT_OBJ_23)
+ else if ((IM->CopyOrFlag & VERT_BITS_OBJ_234) == VERT_BITS_OBJ_23)
tmp->Obj.size = 3;
else
tmp->Obj.size = 2;
}
- if (inputs & VERT_NORMAL_BIT) {
+ if (inputs & VERT_BIT_NORMAL) {
tmp->Normal.data = IM->Attrib[VERT_ATTRIB_NORMAL] + start;
tmp->Normal.start = (GLfloat *) (IM->Attrib[VERT_ATTRIB_NORMAL] + start);
tmp->Normal.count = count;
@@ -295,31 +297,31 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
VB->NormalLengthPtr = IM->NormalLengthPtr + start;
}
- if (inputs & VERT_INDEX_BIT) {
+ if (inputs & VERT_BIT_INDEX) {
tmp->Index.count = count;
tmp->Index.data = IM->Index + start;
tmp->Index.start = IM->Index + start;
VB->IndexPtr[0] = &tmp->Index;
}
- if (inputs & VERT_FOG_BIT) {
+ if (inputs & VERT_BIT_FOG) {
tmp->FogCoord.data = IM->Attrib[VERT_ATTRIB_FOG] + start;
tmp->FogCoord.start = (GLfloat *) (IM->Attrib[VERT_ATTRIB_FOG] + start);
tmp->FogCoord.count = count;
VB->FogCoordPtr = &tmp->FogCoord;
}
- if (inputs & VERT_COLOR1_BIT) {
+ if (inputs & VERT_BIT_COLOR1) {
tmp->SecondaryColor.Ptr = IM->Attrib[VERT_ATTRIB_COLOR1] + start;
VB->SecondaryColorPtr[0] = &tmp->SecondaryColor;
}
- if (inputs & VERT_EDGEFLAG_BIT) {
+ if (inputs & VERT_BIT_EDGEFLAG) {
VB->EdgeFlag = IM->EdgeFlag + start;
}
- if (inputs & VERT_COLOR0_BIT) {
- if (IM->CopyOrFlag & VERT_COLOR0_BIT) {
+ if (inputs & VERT_BIT_COLOR0) {
+ if (IM->CopyOrFlag & VERT_BIT_COLOR0) {
tmp->Color.Ptr = IM->Attrib[VERT_ATTRIB_COLOR0] + start;
tmp->Color.StrideB = 4 * sizeof(GLfloat);
tmp->Color.Flags = 0;
@@ -329,17 +331,17 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
tmp->Color.StrideB = 0;
tmp->Color.Flags = CA_CLIENT_DATA; /* hack */
VB->import_source = IM;
- VB->importable_data |= VERT_COLOR0_BIT;
+ VB->importable_data |= VERT_BIT_COLOR0;
VB->import_data = _tnl_upgrade_current_data;
}
VB->ColorPtr[0] = &tmp->Color;
}
- if (inputs & VERT_TEX_ANY) {
+ if (inputs & VERT_BITS_TEX_ANY) {
GLuint i;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- VB->TexCoordPtr[i] = 0;
- if (inputs & VERT_TEX(i)) {
+ VB->TexCoordPtr[i] = NULL;
+ if (inputs & VERT_BIT_TEX(i)) {
tmp->TexCoord[i].count = count;
tmp->TexCoord[i].data = IM->Attrib[VERT_ATTRIB_TEX0 + i] + start;
tmp->TexCoord[i].start = (GLfloat *)(IM->Attrib[VERT_ATTRIB_TEX0 + i] + start);
@@ -354,7 +356,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
}
}
- if ((inputs & VERT_MATERIAL) && IM->Material) {
+ if ((inputs & VERT_BIT_MATERIAL) && IM->Material) {
VB->MaterialMask = IM->MaterialMask + start;
VB->Material = IM->Material + start;
}
@@ -375,7 +377,8 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
-/* Called by exec_vert_cassette, execute_compiled_cassette, but not
+/**
+ * Called by exec_vert_cassette, execute_compiled_cassette, but not
* exec_elt_cassette.
*/
void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM )
@@ -384,7 +387,7 @@ void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM )
_tnl_vb_bind_immediate( ctx, IM );
- if (IM->OrFlag & VERT_EVAL_ANY)
+ if (IM->OrFlag & VERT_BITS_EVAL_ANY)
_tnl_eval_immediate( ctx, IM );
/* Invalidate all stored data before and after run:
@@ -397,7 +400,8 @@ void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM )
}
-/* Called for regular vertex cassettes.
+/**
+ * Called for regular vertex cassettes.
*/
static void exec_vert_cassette( GLcontext *ctx, struct immediate *IM )
{
@@ -420,7 +424,7 @@ static void exec_vert_cassette( GLcontext *ctx, struct immediate *IM )
}
-/* Called for pure, locked VERT_ELT cassettes instead of
+/* Called for pure, locked VERT_BIT_ELT cassettes instead of
* _tnl_run_cassette.
*/
static void exec_elt_cassette( GLcontext *ctx, struct immediate *IM )
@@ -463,7 +467,8 @@ exec_empty_cassette( GLcontext *ctx, struct immediate *IM )
-/* Called for all cassettes when not compiling or playing a display
+/**
+ * Called for all cassettes when not compiling or playing a display
* list.
*/
void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM )
@@ -480,7 +485,7 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM )
if (IM->CopyStart == IM->Count) {
exec_empty_cassette( ctx, IM );
}
- else if ((IM->CopyOrFlag & VERT_DATA) == VERT_ELT &&
+ else if ((IM->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT &&
ctx->Array.LockCount &&
ctx->Array.Vertex.Enabled) {
exec_elt_cassette( ctx, IM );
@@ -514,7 +519,8 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM )
-/* Setup vector pointers that will be used to bind immediates to VB's.
+/**
+ * Setup vector pointers that will be used to bind immediates to VB's.
*/
void _tnl_imm_init( GLcontext *ctx )
{
@@ -540,14 +546,14 @@ void _tnl_imm_init( GLcontext *ctx )
_mesa_vector4f_init( &tmp->Obj, 0, 0 );
_mesa_vector4f_init( &tmp->Normal, 0, 0 );
- tmp->Color.Ptr = 0;
+ tmp->Color.Ptr = NULL;
tmp->Color.Type = GL_FLOAT;
tmp->Color.Size = 4;
tmp->Color.Stride = 0;
tmp->Color.StrideB = 4 * sizeof(GLfloat);
tmp->Color.Flags = 0;
- tmp->SecondaryColor.Ptr = 0;
+ tmp->SecondaryColor.Ptr = NULL;
tmp->SecondaryColor.Type = GL_FLOAT;
tmp->SecondaryColor.Size = 4;
tmp->SecondaryColor.Stride = 0;
@@ -570,6 +576,10 @@ void _tnl_imm_init( GLcontext *ctx )
}
+/**
+ * Deallocate the immediate-mode buffer for the given context, if
+ * its reference count goes to zero.
+ */
void _tnl_imm_destroy( GLcontext *ctx )
{
if (TNL_CURRENT_IM(ctx)) {
@@ -583,6 +593,6 @@ void _tnl_imm_destroy( GLcontext *ctx )
* So we just set the context's own tnl immediate pointer
* to 0.
*/
- ctx->swtnl_im = 0;
+ ctx->swtnl_im = NULL;
}
}
diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c
index 6e52187a47..d08c162efe 100644
--- a/src/mesa/tnl/t_imm_fixup.c
+++ b/src/mesa/tnl/t_imm_fixup.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_fixup.c,v 1.32 2002/01/06 03:54:12 brianp Exp $ */
+/* $Id: t_imm_fixup.c,v 1.33 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -65,7 +65,7 @@ _tnl_fixup_4f( GLfloat data[][4], GLuint flag[], GLuint start, GLuint match )
for (;;) {
if ((flag[++i] & match) == 0) {
COPY_4FV(data[i], data[i-1]);
- if (flag[i] & VERT_END_VB) break;
+ if (flag[i] & VERT_BIT_END_VB) break;
}
}
}
@@ -84,7 +84,7 @@ _tnl_fixup_3f( float data[][3], GLuint flag[], GLuint start, GLuint match )
/* data[i-1][1], */
/* data[i-1][2]); */
COPY_3V(data[i], data[i-1]);
- if (flag[i] & VERT_END_VB) break;
+ if (flag[i] & VERT_BIT_END_VB) break;
}
}
}
@@ -98,7 +98,7 @@ _tnl_fixup_1ui( GLuint *data, GLuint flag[], GLuint start, GLuint match )
for (;;) {
if ((flag[++i] & match) == 0) {
data[i] = data[i-1];
- if (flag[i] & VERT_END_VB) break;
+ if (flag[i] & VERT_BIT_END_VB) break;
}
}
flag[i] |= match;
@@ -113,7 +113,7 @@ _tnl_fixup_1f( GLfloat *data, GLuint flag[], GLuint start, GLuint match )
for (;;) {
if ((flag[++i] & match) == 0) {
data[i] = data[i-1];
- if (flag[i] & VERT_END_VB) break;
+ if (flag[i] & VERT_BIT_END_VB) break;
}
}
flag[i] |= match;
@@ -127,7 +127,7 @@ _tnl_fixup_1ub( GLubyte *data, GLuint flag[], GLuint start, GLuint match )
for (;;) {
if ((flag[++i] & match) == 0) {
data[i] = data[i-1];
- if (flag[i] & VERT_END_VB) break;
+ if (flag[i] & VERT_BIT_END_VB) break;
}
}
flag[i] |= match;
@@ -139,7 +139,7 @@ fixup_first_4f( GLfloat data[][4], GLuint flag[], GLuint match,
GLuint start, GLfloat *dflt )
{
GLuint i = start-1;
- match |= VERT_END_VB;
+ match |= VERT_BIT_END_VB;
while ((flag[++i]&match) == 0)
COPY_4FV(data[i], dflt);
@@ -151,7 +151,7 @@ fixup_first_3f( GLfloat data[][3], GLuint flag[], GLuint match,
GLuint start, GLfloat *dflt )
{
GLuint i = start-1;
- match |= VERT_END_VB;
+ match |= VERT_BIT_END_VB;
/* fprintf(stderr, "fixup_first_3f default: %f %f %f start: %d\n", */
/* dflt[0], dflt[1], dflt[2], start); */
@@ -166,7 +166,7 @@ fixup_first_1ui( GLuint data[], GLuint flag[], GLuint match,
GLuint start, GLuint dflt )
{
GLuint i = start-1;
- match |= VERT_END_VB;
+ match |= VERT_BIT_END_VB;
while ((flag[++i]&match) == 0)
data[i] = dflt;
@@ -178,7 +178,7 @@ fixup_first_1f( GLfloat data[], GLuint flag[], GLuint match,
GLuint start, GLfloat dflt )
{
GLuint i = start-1;
- match |= VERT_END_VB;
+ match |= VERT_BIT_END_VB;
while ((flag[++i]&match) == 0)
data[i] = dflt;
@@ -190,7 +190,7 @@ fixup_first_1ub( GLubyte data[], GLuint flag[], GLuint match,
GLuint start, GLubyte dflt )
{
GLuint i = start-1;
- match |= VERT_END_VB;
+ match |= VERT_BIT_END_VB;
while ((flag[++i]&match) == 0)
data[i] = dflt;
@@ -209,27 +209,27 @@ static void copy_from_current( GLcontext *ctx, struct immediate *IM,
_tnl_print_vert_flags("copy from current", copyMask);
#if 0
- if (copyMask & VERT_NORMAL_BIT) {
+ if (copyMask & VERT_BIT_NORMAL) {
COPY_4V(IM->Attrib[VERT_ATTRIB_NORMAL][pos],
ctx->Current.Attrib[VERT_ATTRIB_NORMAL]);
}
- if (copyMask & VERT_COLOR0_BIT) {
+ if (copyMask & VERT_BIT_COLOR0) {
COPY_4FV( IM->Attrib[VERT_ATTRIB_COLOR0][pos],
ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
}
- if (copyMask & VERT_COLOR1_BIT)
+ if (copyMask & VERT_BIT_COLOR1)
COPY_4FV( IM->Attrib[VERT_ATTRIB_COLOR1][pos],
ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
- if (copyMask & VERT_FOG_BIT)
+ if (copyMask & VERT_BIT_FOG)
IM->Attrib[VERT_ATTRIB_FOG][pos][0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
- if (copyMask & VERT_TEX_ANY) {
+ if (copyMask & VERT_BITS_TEX_ANY) {
GLuint i;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
- if (copyMask & VERT_TEX(i))
+ if (copyMask & VERT_BIT_TEX(i))
COPY_4FV(IM->Attrib[VERT_ATTRIB_TEX0 + i][pos],
ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i]);
}
@@ -242,10 +242,10 @@ static void copy_from_current( GLcontext *ctx, struct immediate *IM,
}
#endif
- if (copyMask & VERT_INDEX_BIT)
+ if (copyMask & VERT_BIT_INDEX)
IM->Index[pos] = ctx->Current.Index;
- if (copyMask & VERT_EDGEFLAG_BIT)
+ if (copyMask & VERT_BIT_EDGEFLAG)
IM->EdgeFlag[pos] = ctx->Current.EdgeFlag;
}
@@ -266,7 +266,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
/* _tnl_print_vert_flags("Andflag", andflag); */
- fixup = ~andflag & VERT_FIXUP;
+ fixup = ~andflag & VERT_BITS_FIXUP;
if (!ctx->CompileFlag)
fixup &= tnl->pipeline.inputs;
@@ -274,7 +274,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
if (!ctx->ExecuteFlag)
fixup &= orflag;
- if ((orflag & (VERT_OBJ_BIT|VERT_EVAL_ANY)) == 0)
+ if ((orflag & (VERT_BIT_POS|VERT_BITS_EVAL_ANY)) == 0)
fixup = 0;
if (fixup) {
@@ -294,80 +294,80 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
* vertex attributes.
*/
- if (fixup & VERT_TEX_ANY) {
+ if (fixup & VERT_BITS_TEX_ANY) {
GLuint i;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
- if (fixup & VERT_TEX(i)) {
- if (orflag & VERT_TEX(i))
+ if (fixup & VERT_BIT_TEX(i)) {
+ if (orflag & VERT_BIT_TEX(i))
_tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag,
- start, VERT_TEX(i) );
+ start, VERT_BIT_TEX(i) );
else
fixup_first_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag,
- VERT_END_VB, start,
+ VERT_BIT_END_VB, start,
IM->Attrib[VERT_ATTRIB_TEX0 + i][start]);
}
}
}
- if (fixup & VERT_EDGEFLAG_BIT) {
- if (orflag & VERT_EDGEFLAG_BIT)
- _tnl_fixup_1ub( IM->EdgeFlag, IM->Flag, start, VERT_EDGEFLAG_BIT );
+ if (fixup & VERT_BIT_EDGEFLAG) {
+ if (orflag & VERT_BIT_EDGEFLAG)
+ _tnl_fixup_1ub( IM->EdgeFlag, IM->Flag, start, VERT_BIT_EDGEFLAG );
else
- fixup_first_1ub( IM->EdgeFlag, IM->Flag, VERT_END_VB, start,
+ fixup_first_1ub( IM->EdgeFlag, IM->Flag, VERT_BIT_END_VB, start,
IM->EdgeFlag[start] );
}
- if (fixup & VERT_INDEX_BIT) {
- if (orflag & VERT_INDEX_BIT)
- _tnl_fixup_1ui( IM->Index, IM->Flag, start, VERT_INDEX_BIT );
+ if (fixup & VERT_BIT_INDEX) {
+ if (orflag & VERT_BIT_INDEX)
+ _tnl_fixup_1ui( IM->Index, IM->Flag, start, VERT_BIT_INDEX );
else
- fixup_first_1ui( IM->Index, IM->Flag, VERT_END_VB, start,
+ fixup_first_1ui( IM->Index, IM->Flag, VERT_BIT_END_VB, start,
IM->Index[start] );
}
- if (fixup & VERT_COLOR0_BIT) {
- if (orflag & VERT_COLOR0_BIT)
+ if (fixup & VERT_BIT_COLOR0) {
+ if (orflag & VERT_BIT_COLOR0)
_tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag, start,
- VERT_COLOR0_BIT );
+ VERT_BIT_COLOR0 );
/* No need for else case as the drivers understand stride
* zero here. (TODO - propogate this)
*/
}
- if (fixup & VERT_COLOR1_BIT) {
- if (orflag & VERT_COLOR1_BIT)
+ if (fixup & VERT_BIT_COLOR1) {
+ if (orflag & VERT_BIT_COLOR1)
_tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag, start,
- VERT_COLOR1_BIT );
+ VERT_BIT_COLOR1 );
else
- fixup_first_4f( IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag, VERT_END_VB, start,
+ fixup_first_4f( IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag, VERT_BIT_END_VB, start,
IM->Attrib[VERT_ATTRIB_COLOR1][start] );
}
- if (fixup & VERT_FOG_BIT) {
- if (orflag & VERT_FOG_BIT)
+ if (fixup & VERT_BIT_FOG) {
+ if (orflag & VERT_BIT_FOG)
_tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag,
- start, VERT_FOG_BIT );
+ start, VERT_BIT_FOG );
else
- fixup_first_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag, VERT_END_VB,
+ fixup_first_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag, VERT_BIT_END_VB,
start, IM->Attrib[VERT_ATTRIB_FOG][start] );
}
- if (fixup & VERT_NORMAL_BIT) {
- if (orflag & VERT_NORMAL_BIT)
+ if (fixup & VERT_BIT_NORMAL) {
+ if (orflag & VERT_BIT_NORMAL)
_tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag, start,
- VERT_NORMAL_BIT );
+ VERT_BIT_NORMAL );
else
fixup_first_4f( IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag,
- VERT_END_VB, start,
+ VERT_BIT_END_VB, start,
IM->Attrib[VERT_ATTRIB_NORMAL][start] );
}
}
/* Prune possible half-filled slot.
*/
- IM->Flag[IM->LastData+1] &= ~VERT_END_VB;
- IM->Flag[IM->Count] |= VERT_END_VB;
+ IM->Flag[IM->LastData+1] &= ~VERT_BIT_END_VB;
+ IM->Flag[IM->Count] |= VERT_BIT_END_VB;
/* Materials:
@@ -377,7 +377,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
GLuint i = IM->Start;
do {
- while (!(IM->Flag[i] & VERT_MATERIAL))
+ while (!(IM->Flag[i] & VERT_BIT_MATERIAL))
i++;
vulnerable &= ~IM->MaterialMask[i];
@@ -391,22 +391,24 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
}
-
-
-static void copy_material( struct immediate *next,
- struct immediate *prev,
- GLuint dst, GLuint src )
+static void
+copy_material( struct immediate *next,
+ struct immediate *prev,
+ GLuint dst, GLuint src )
{
if (next->Material == 0) {
- next->Material = (GLmaterial (*)[2]) MALLOC( sizeof(GLmaterial) *
- IMM_SIZE * 2 );
+ next->Material = (struct gl_material (*)[2])
+ MALLOC( sizeof(struct gl_material) * IMM_SIZE * 2 );
next->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE );
}
next->MaterialMask[dst] = prev->MaterialOrMask;
- MEMCPY(next->Material[dst], prev->Material[src], 2*sizeof(GLmaterial));
+ MEMCPY(next->Material[dst], prev->Material[src],
+ 2 * sizeof(struct gl_material));
}
+
+
static GLboolean is_fan_like[GL_POLYGON+1] = {
GL_FALSE,
GL_FALSE,
@@ -447,7 +449,7 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
next->CopyStart = next->Start - count;
- if ((prev->CopyOrFlag & VERT_DATA) == VERT_ELT &&
+ if ((prev->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT &&
ctx->Array.LockCount &&
ctx->Array.Vertex.Enabled)
{
@@ -458,24 +460,24 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
GLuint src = elts[i+offset];
GLuint dst = next->CopyStart+i;
next->Elt[dst] = prev->Elt[src];
- next->Flag[dst] = VERT_ELT;
+ next->Flag[dst] = VERT_BIT_ELT;
}
-/* fprintf(stderr, "ADDING VERT_ELT!\n"); */
- next->CopyOrFlag |= VERT_ELT;
- next->CopyAndFlag &= VERT_ELT;
+/* fprintf(stderr, "ADDING VERT_BIT_ELT!\n"); */
+ next->CopyOrFlag |= VERT_BIT_ELT;
+ next->CopyAndFlag &= VERT_BIT_ELT;
}
else {
GLuint copy = tnl->pipeline.inputs & (prev->CopyOrFlag|prev->Evaluated);
GLuint flag;
if (is_fan_like[ctx->Driver.CurrentExecPrimitive]) {
- flag = ((prev->CopyOrFlag|prev->Evaluated) & VERT_FIXUP);
+ flag = ((prev->CopyOrFlag|prev->Evaluated) & VERT_BITS_FIXUP);
next->CopyOrFlag |= flag;
}
else {
/* Don't let an early 'glColor', etc. poison the elt path.
*/
- flag = ((prev->OrFlag|prev->Evaluated) & VERT_FIXUP);
+ flag = ((prev->OrFlag|prev->Evaluated) & VERT_BITS_FIXUP);
}
next->TexSize |= tnl->ExecCopyTexSize;
@@ -502,7 +504,7 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
COPY_4FV( next->Attrib[VERT_ATTRIB_POS][dst],
inputs->Obj.data[isrc] );
- if (copy & VERT_NORMAL_BIT) {
+ if (copy & VERT_BIT_NORMAL) {
/* fprintf(stderr, "copy vert norm %d to %d (%p): %f %f %f\n", */
/* isrc, dst, */
/* next->Normal[dst], */
@@ -512,17 +514,17 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
COPY_3FV( next->Attrib[VERT_ATTRIB_NORMAL][dst], inputs->Normal.data[isrc] );
}
- if (copy & VERT_COLOR0_BIT)
+ if (copy & VERT_BIT_COLOR0)
COPY_4FV( next->Attrib[VERT_ATTRIB_COLOR0][dst],
((GLfloat (*)[4])inputs->Color.Ptr)[isrc] );
- if (copy & VERT_INDEX_BIT)
+ if (copy & VERT_BIT_INDEX)
next->Index[dst] = inputs->Index.data[isrc];
- if (copy & VERT_TEX_ANY) {
+ if (copy & VERT_BITS_TEX_ANY) {
GLuint i;
for (i = 0 ; i < prev->MaxTextureUnits ; i++) {
- if (copy & VERT_TEX(i))
+ if (copy & VERT_BIT_TEX(i))
COPY_4FV( next->Attrib[VERT_ATTRIB_TEX0 + i][dst],
inputs->TexCoord[i].data[isrc] );
}
@@ -531,10 +533,10 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
/* Remaining values should be the same in the 'input' struct and the
* original immediate.
*/
- if (copy & (VERT_ELT|VERT_EDGEFLAG_BIT|VERT_COLOR1_BIT|VERT_FOG_BIT|
- VERT_MATERIAL)) {
+ if (copy & (VERT_BIT_ELT|VERT_BIT_EDGEFLAG|VERT_BIT_COLOR1|VERT_BIT_FOG|
+ VERT_BIT_MATERIAL)) {
- if (prev->Flag[src] & VERT_MATERIAL)
+ if (prev->Flag[src] & VERT_BIT_MATERIAL)
copy_material(next, prev, dst, src);
next->Elt[dst] = prev->Elt[src];
@@ -546,9 +548,9 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
}
next->Flag[dst] = flag;
- next->CopyOrFlag |= prev->Flag[src] & (VERT_FIXUP|
- VERT_MATERIAL|
- VERT_OBJ_BIT);
+ next->CopyOrFlag |= prev->Flag[src] & (VERT_BITS_FIXUP|
+ VERT_BIT_MATERIAL|
+ VERT_BIT_POS);
}
}
@@ -588,7 +590,7 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM )
/* Naked array elements can be copied into the first cassette in a
* display list. Need to translate them away:
*/
- if (IM->CopyOrFlag & VERT_ELT) {
+ if (IM->CopyOrFlag & VERT_BIT_ELT) {
GLuint copy = tnl->pipeline.inputs & ~ctx->Array._Enabled;
GLuint i;
@@ -602,7 +604,7 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM )
_tnl_copy_to_current( ctx, IM, ctx->Array._Enabled, IM->Start );
}
- fixup = tnl->pipeline.inputs & ~IM->Flag[start] & VERT_FIXUP;
+ fixup = tnl->pipeline.inputs & ~IM->Flag[start] & VERT_BITS_FIXUP;
/* _tnl_print_vert_flags("fixup compiled", fixup); */
@@ -612,47 +614,47 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM )
* attributes.
*/
- if (fixup & VERT_NORMAL_BIT) {
+ if (fixup & VERT_BIT_NORMAL) {
fixup_first_4f(IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag,
- VERT_NORMAL_BIT, start,
+ VERT_BIT_NORMAL, start,
ctx->Current.Attrib[VERT_ATTRIB_NORMAL] );
}
- if (fixup & VERT_COLOR0_BIT) {
- if (IM->CopyOrFlag & VERT_COLOR0_BIT)
+ if (fixup & VERT_BIT_COLOR0) {
+ if (IM->CopyOrFlag & VERT_BIT_COLOR0)
fixup_first_4f(IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag,
- VERT_COLOR0_BIT, start,
+ VERT_BIT_COLOR0, start,
ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
else
- fixup &= ~VERT_COLOR0_BIT;
+ fixup &= ~VERT_BIT_COLOR0;
}
- if (fixup & VERT_COLOR1_BIT)
+ if (fixup & VERT_BIT_COLOR1)
fixup_first_4f(IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag,
- VERT_COLOR1_BIT, start,
+ VERT_BIT_COLOR1, start,
ctx->Current.Attrib[VERT_ATTRIB_COLOR1] );
- if (fixup & VERT_FOG_BIT)
+ if (fixup & VERT_BIT_FOG)
fixup_first_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag,
- VERT_FOG_BIT, start,
+ VERT_BIT_FOG, start,
ctx->Current.Attrib[VERT_ATTRIB_FOG] );
- if (fixup & VERT_TEX_ANY) {
+ if (fixup & VERT_BITS_TEX_ANY) {
GLuint i;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
- if (fixup & VERT_TEX(i))
+ if (fixup & VERT_BIT_TEX(i))
fixup_first_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag,
- VERT_TEX(i), start,
+ VERT_BIT_TEX(i), start,
ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i] );
}
}
- if (fixup & VERT_EDGEFLAG_BIT)
- fixup_first_1ub(IM->EdgeFlag, IM->Flag, VERT_EDGEFLAG_BIT, start,
+ if (fixup & VERT_BIT_EDGEFLAG)
+ fixup_first_1ub(IM->EdgeFlag, IM->Flag, VERT_BIT_EDGEFLAG, start,
ctx->Current.EdgeFlag );
- if (fixup & VERT_INDEX_BIT)
- fixup_first_1ui(IM->Index, IM->Flag, VERT_INDEX_BIT, start,
+ if (fixup & VERT_BIT_INDEX)
+ fixup_first_1ui(IM->Index, IM->Flag, VERT_BIT_INDEX, start,
ctx->Current.Index );
IM->CopyOrFlag |= fixup;
@@ -666,7 +668,7 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM )
GLuint i = IM->Start;
do {
- while (!(IM->Flag[i] & VERT_MATERIAL))
+ while (!(IM->Flag[i] & VERT_BIT_MATERIAL))
i++;
vulnerable &= ~IM->MaterialMask[i];
@@ -837,7 +839,7 @@ void _tnl_upgrade_current_data( GLcontext *ctx,
/* _tnl_print_vert_flags("_tnl_upgrade_client_data", required); */
- if ((required & VERT_COLOR0_BIT) && (VB->ColorPtr[0]->Flags & CA_CLIENT_DATA)) {
+ if ((required & VERT_BIT_COLOR0) && (VB->ColorPtr[0]->Flags & CA_CLIENT_DATA)) {
struct gl_client_array *tmp = &tnl->imm_inputs.Color;
GLuint start = IM->CopyStart;
@@ -849,13 +851,14 @@ void _tnl_upgrade_current_data( GLcontext *ctx,
ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
/*
- ASSERT(IM->Flag[IM->LastData+1] & VERT_END_VB);
+ ASSERT(IM->Flag[IM->LastData+1] & VERT_BIT_END_VB);
*/
- fixup_first_4f( IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag, VERT_END_VB,
+ fixup_first_4f( IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag,
+ VERT_BIT_END_VB,
start, IM->Attrib[VERT_ATTRIB_COLOR0][start] );
- VB->importable_data &= ~VERT_COLOR0_BIT;
+ VB->importable_data &= ~VERT_BIT_COLOR0;
}
}
diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c
index f92e21fe48..d17719f6d7 100644
--- a/src/mesa/tnl/t_pipeline.c
+++ b/src/mesa/tnl/t_pipeline.c
@@ -1,4 +1,4 @@
-/* $Id: t_pipeline.c,v 1.21 2001/12/15 02:13:32 brianp Exp $ */
+/* $Id: t_pipeline.c,v 1.22 2002/01/22 14:35:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -186,7 +186,7 @@ void _tnl_run_pipeline( GLcontext *ctx )
*
* - inserting optimized (but specialized) stages ahead of the
* general-purpose fallback implementation. For example, the old
- * fastpath mechanism, which only works when the VERT_ELT input is
+ * fastpath mechanism, which only works when the VERT_BIT_ELT input is
* available, can be duplicated by placing the fastpath stage at the
* head of this pipeline. Such specialized stages are currently
* constrained to have no outputs (ie. they must either finish the *
diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c
index d0e87cdbd8..01b553a191 100644
--- a/src/mesa/tnl/t_vb_fog.c
+++ b/src/mesa/tnl/t_vb_fog.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_fog.c,v 1.16 2002/01/06 03:54:12 brianp Exp $ */
+/* $Id: t_vb_fog.c,v 1.17 2002/01/22 14:35:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -196,9 +196,9 @@ static void check_fog_stage( GLcontext *ctx, struct gl_pipeline_stage *stage )
stage->active = ctx->Fog.Enabled && !ctx->VertexProgram.Enabled;
if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT)
- stage->inputs = VERT_EYE;
+ stage->inputs = VERT_BIT_EYE;
else
- stage->inputs = VERT_FOG_BIT;
+ stage->inputs = VERT_BIT_FOG;
}
@@ -245,7 +245,7 @@ const struct gl_pipeline_stage _tnl_fog_coordinate_stage =
_NEW_FOG, /* run_state */
GL_FALSE, /* active? */
0, /* inputs */
- VERT_FOG_BIT, /* outputs */
+ VERT_BIT_FOG, /* outputs */
0, /* changed_inputs */
NULL, /* private_data */
free_fog_data, /* dtr */
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index bbf43468c0..32444ee3aa 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_light.c,v 1.16 2001/12/14 02:51:45 brianp Exp $ */
+/* $Id: t_vb_light.c,v 1.17 2002/01/22 14:35:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -168,12 +168,12 @@ static GLboolean run_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage )
/* Make sure we can talk about elements 0..2 in the vector we are
* lighting.
*/
- if (stage->changed_inputs & (VERT_EYE|VERT_OBJ_BIT)) {
+ if (stage->changed_inputs & (VERT_BIT_EYE|VERT_BIT_POS)) {
if (input->size <= 2) {
if (input->flags & VEC_NOT_WRITEABLE) {
- ASSERT(VB->importable_data & VERT_OBJ_BIT);
+ ASSERT(VB->importable_data & VERT_BIT_POS);
- VB->import_data( ctx, VERT_OBJ_BIT, VEC_NOT_WRITEABLE );
+ VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE );
input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr;
ASSERT((input->flags & VEC_NOT_WRITEABLE) == 0);
@@ -299,15 +299,15 @@ static void check_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage )
if (stage->active) {
if (stage->privatePtr)
stage->run = run_validate_lighting;
- stage->inputs = VERT_NORMAL_BIT|VERT_MATERIAL;
+ stage->inputs = VERT_BIT_NORMAL|VERT_BIT_MATERIAL;
if (ctx->Light._NeedVertices)
- stage->inputs |= VERT_EYE; /* effectively, even when lighting in obj */
+ stage->inputs |= VERT_BIT_EYE; /* effectively, even when lighting in obj */
if (ctx->Light.ColorMaterialEnabled)
- stage->inputs |= VERT_COLOR0_BIT;
+ stage->inputs |= VERT_BIT_COLOR0;
- stage->outputs = VERT_COLOR0_BIT;
+ stage->outputs = VERT_BIT_COLOR0;
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
- stage->outputs |= VERT_COLOR1_BIT;
+ stage->outputs |= VERT_BIT_COLOR1;
}
}
@@ -338,7 +338,7 @@ const struct gl_pipeline_stage _tnl_lighting_stage =
_NEW_LIGHT, /* recheck */
_NEW_LIGHT|_NEW_MODELVIEW, /* recalc -- modelview dependency
* otherwise not captured by inputs
- * (which may be VERT_OBJ_BIT) */
+ * (which may be VERT_BIT_POS) */
GL_FALSE, /* active? */
0, /* inputs */
0, /* outputs */
diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h
index 8532180309..ef25cd69bc 100644
--- a/src/mesa/tnl/t_vb_lighttmp.h
+++ b/src/mesa/tnl/t_vb_lighttmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_vb_lighttmp.h,v 1.23 2002/01/05 20:51:13 brianp Exp $ */
+/* $Id: t_vb_lighttmp.h,v 1.24 2002/01/22 14:35:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,24 +33,24 @@
#if (IDX & LIGHT_FLAGS)
# define VSTRIDE (4 * sizeof(GLfloat))
# define NSTRIDE nstride /*(3 * sizeof(GLfloat))*/
-# define CHECK_MATERIAL(x) (flags[x] & VERT_MATERIAL)
-# define CHECK_END_VB(x) (flags[x] & VERT_END_VB)
+# define CHECK_MATERIAL(x) (flags[x] & VERT_BIT_MATERIAL)
+# define CHECK_END_VB(x) (flags[x] & VERT_BIT_END_VB)
# if (IDX & LIGHT_COLORMATERIAL)
# define CMSTRIDE STRIDE_F(CMcolor, CMstride)
-# define CHECK_COLOR_MATERIAL(x) (flags[x] & VERT_COLOR0_BIT)
-# define CHECK_VALIDATE(x) (flags[x] & (VERT_COLOR0_BIT|VERT_MATERIAL))
+# define CHECK_COLOR_MATERIAL(x) (flags[x] & VERT_BIT_COLOR0)
+# define CHECK_VALIDATE(x) (flags[x] & (VERT_BIT_COLOR0|VERT_BIT_MATERIAL))
# define DO_ANOTHER_NORMAL(x) \
- ((flags[x] & (VERT_COLOR0_BIT|VERT_NORMAL_BIT|VERT_END_VB|VERT_MATERIAL)) == VERT_NORMAL_BIT)
+ ((flags[x] & (VERT_BIT_COLOR0|VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == VERT_BIT_NORMAL)
# define REUSE_LIGHT_RESULTS(x) \
- ((flags[x] & (VERT_COLOR0_BIT|VERT_NORMAL_BIT|VERT_END_VB|VERT_MATERIAL)) == 0)
+ ((flags[x] & (VERT_BIT_COLOR0|VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == 0)
# else
# define CMSTRIDE (void)0
# define CHECK_COLOR_MATERIAL(x) 0
-# define CHECK_VALIDATE(x) (flags[x] & (VERT_MATERIAL))
+# define CHECK_VALIDATE(x) (flags[x] & (VERT_BIT_MATERIAL))
# define DO_ANOTHER_NORMAL(x) \
- ((flags[x] & (VERT_NORMAL_BIT|VERT_END_VB|VERT_MATERIAL)) == VERT_NORMAL_BIT)
+ ((flags[x] & (VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == VERT_BIT_NORMAL)
# define REUSE_LIGHT_RESULTS(x) \
- ((flags[x] & (VERT_NORMAL_BIT|VERT_END_VB|VERT_MATERIAL)) == 0)
+ ((flags[x] & (VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == 0)
# endif
#else
# define VSTRIDE vstride
diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c
index da814a4e0e..06d2fde4ea 100644
--- a/src/mesa/tnl/t_vb_normals.c
+++ b/src/mesa/tnl/t_vb_normals.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_normals.c,v 1.12 2002/01/05 20:51:13 brianp Exp $ */
+/* $Id: t_vb_normals.c,v 1.13 2002/01/22 14:35:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -179,8 +179,8 @@ const struct gl_pipeline_stage _tnl_normal_transform_stage =
_TNL_NEW_NORMAL_TRANSFORM, /* re-check */
_TNL_NEW_NORMAL_TRANSFORM, /* re-run */
GL_FALSE, /* active? */
- VERT_NORMAL_BIT, /* inputs */
- VERT_NORMAL_BIT, /* outputs */
+ VERT_BIT_NORMAL, /* inputs */
+ VERT_BIT_NORMAL, /* outputs */
0, /* changed_inputs */
NULL, /* private data */
free_normal_data, /* destructor */
diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c
index a6757a8bf0..21832d47e8 100644
--- a/src/mesa/tnl/t_vb_points.c
+++ b/src/mesa/tnl/t_vb_points.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_points.c,v 1.7 2002/01/06 20:39:19 brianp Exp $ */
+/* $Id: t_vb_points.c,v 1.8 2002/01/22 14:35:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -114,8 +114,8 @@ const struct gl_pipeline_stage _tnl_point_attenuation_stage =
_NEW_POINT, /* build_state_change */
_NEW_POINT, /* run_state_change */
GL_FALSE, /* active */
- VERT_EYE, /* inputs */
- VERT_POINT_SIZE, /* outputs */
+ VERT_BIT_EYE, /* inputs */
+ VERT_BIT_POINT_SIZE, /* outputs */
0, /* changed_inputs (temporary value) */
NULL, /* stage private data */
free_point_data, /* destructor */
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index c63cf55663..2097ecc8cc 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_program.c,v 1.9 2002/01/12 02:57:14 brianp Exp $ */
+/* $Id: t_vb_program.c,v 1.10 2002/01/22 14:35:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -70,9 +70,10 @@
* ---------------------------------------------
*/
-/*
- * Authors:
- * Brian Paul
+/**
+ * \file tnl/t_vb_program.c
+ * \brief Pipeline stage for executing vertex programs
+ * \author Brian Paul, Keith Whitwell
*/
@@ -98,7 +99,8 @@
#include "t_imm_exec.h"
-/* WARNING: these values _MUST_ match the values in the OutputRegisters[]
+/**
+ * \warning These values _MUST_ match the values in the OutputRegisters[]
* array in vpparse.c!!!
*/
#define VERT_RESULT_HPOS 0
@@ -118,23 +120,29 @@
#define VERT_RESULT_TEX7 14
+/*!
+ * Private storage for the vertex program pipeline stage.
+ */
struct vp_stage_data {
- /* The results of running the vertex program go into these arrays. */
+ /** The results of running the vertex program go into these arrays. */
GLvector4f attribs[15];
/* These point to the attribs[VERT_RESULT_COL0, COL1, BFC0, BFC1] arrays */
- struct gl_client_array color0[2]; /* diffuse front and back */
- struct gl_client_array color1[2]; /* specular front and back */
+ struct gl_client_array color0[2]; /**< diffuse front and back */
+ struct gl_client_array color1[2]; /**< specular front and back */
- GLvector4f ndcCoords; /* normalized device coords */
- GLubyte *clipmask; /* clip flags */
- GLubyte ormask, andmask;
+ GLvector4f ndcCoords; /**< normalized device coords */
+ GLubyte *clipmask; /**< clip flags */
+ GLubyte ormask, andmask; /**< for clipping */
};
#define VP_STAGE_DATA(stage) ((struct vp_stage_data *)(stage->privatePtr))
+/**
+ * This function executes vertex programs
+ */
static GLboolean run_vp( GLcontext *ctx, struct gl_pipeline_stage *stage )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -174,11 +182,30 @@ static GLboolean run_vp( GLcontext *ctx, struct gl_pipeline_stage *stage )
VB->AttribPtr[2]->data[i][3]);
#endif
+ /* XXXX
+ * We have to deal with stride!=16 bytes, size!=4, etc in these loops!!!
+ */
+
/* load the input attribute registers */
- for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
- if (VB->Flag[i] & (1 << attr)) {
- COPY_4V(machine->Registers[VP_INPUT_REG_START + attr],
- VB->AttribPtr[attr]->data[i]);
+ if (VB->Flag) {
+ /* the traditional glBegin/glVertex/glEnd case */
+ for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
+ if (VB->Flag[i] & (1 << attr)) {
+ COPY_4V(machine->Registers[VP_INPUT_REG_START + attr],
+ VB->AttribPtr[attr]->data[i]);
+ }
+ }
+ }
+ else {
+ /* the vertex array case */
+ for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
+ const GLubyte *ptr = (const GLubyte *) VB->AttribPtr[attr]->data;
+ const GLint stride = VB->AttribPtr[attr]->stride;
+ const GLfloat *data = (GLfloat *) (ptr + stride * i);
+ const GLint size = VB->AttribPtr[attr]->size;
+ COPY_4V(machine->Registers[VP_INPUT_REG_START + attr], data);
+ if (size == 3)
+ machine->Registers[VP_INPUT_REG_START + attr][3] = 1.0;
}
}
@@ -259,15 +286,16 @@ static GLboolean run_vp( GLcontext *ctx, struct gl_pipeline_stage *stage )
VB->ClipMask = store->clipmask;
/* XXXX what's this?
- if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_OBJ_BIT))
- VB->importable_data |= VERT_CLIP;
+ if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_BIT_POS))
+ VB->importable_data |= VERT_BIT_CLIP;
*/
return GL_TRUE;
}
-/* Called in place of do_lighting when the light table may have changed.
+/**
+ * This function validates stuff.
*/
static GLboolean run_validate_program( GLcontext *ctx,
struct gl_pipeline_stage *stage )
@@ -314,7 +342,10 @@ static GLboolean run_validate_program( GLcontext *ctx,
}
-static void init_client_array( struct gl_client_array *a, GLvector4f *vec )
+/**
+ * Initialize a gl_client_array to point into a GLvector4f color vector.
+ */
+static void init_color_array( struct gl_client_array *a, GLvector4f *vec )
{
a->Ptr = vec->data;
a->Size = 4;
@@ -326,7 +357,8 @@ static void init_client_array( struct gl_client_array *a, GLvector4f *vec )
}
-/* Called the first time stage->run is called. In effect, don't
+/**
+ * Called the first time stage->run is called. In effect, don't
* allocate data until the first time the stage is run.
*/
static GLboolean run_init_vp( GLcontext *ctx,
@@ -348,10 +380,10 @@ static GLboolean run_init_vp( GLcontext *ctx,
_mesa_vector4f_alloc( &store->attribs[i], 0, size, 32 );
/* Make the color0[] and color1[] arrays point into the attribs[] arrays */
- init_client_array( &store->color0[0], &store->attribs[VERT_RESULT_COL0] );
- init_client_array( &store->color0[1], &store->attribs[VERT_RESULT_COL1] );
- init_client_array( &store->color1[0], &store->attribs[VERT_RESULT_BFC0] );
- init_client_array( &store->color1[1], &store->attribs[VERT_RESULT_BFC1] );
+ init_color_array( &store->color0[0], &store->attribs[VERT_RESULT_COL0] );
+ init_color_array( &store->color0[1], &store->attribs[VERT_RESULT_COL1] );
+ init_color_array( &store->color1[0], &store->attribs[VERT_RESULT_BFC0] );
+ init_color_array( &store->color1[1], &store->attribs[VERT_RESULT_BFC1] );
/* a few other misc allocations */
_mesa_vector4f_alloc( &store->ndcCoords, 0, size, 32 );
@@ -365,7 +397,7 @@ static GLboolean run_init_vp( GLcontext *ctx,
-/*
+/**
* Check if vertex program mode is enabled.
* If so, configure the pipeline stage's type, inputs, and outputs.
*/
@@ -375,23 +407,30 @@ static void check_vp( GLcontext *ctx, struct gl_pipeline_stage *stage )
if (stage->active) {
/* XXX what do we need here??? */
+ /*
+ GLbitfield vpInput = ctx->VertexProgram.Current->InputsRead;
+ */
+
#if 000
if (stage->privatePtr)
stage->run = run_validate_program;
- stage->inputs = VERT_NORMAL_BIT|VERT_MATERIAL;
+ stage->inputs = VERT_BIT_NORMAL|VERT_BIT_MATERIAL;
if (ctx->Light._NeedVertices)
- stage->inputs |= VERT_EYE; /* effectively, even when lighting in obj */
+ stage->inputs |= VERT_BIT_EYE; /* effectively, even when lighting in obj */
if (ctx->Light.ColorMaterialEnabled)
- stage->inputs |= VERT_COLOR0_BIT;
+ stage->inputs |= VERT_BIT_COLOR0;
- stage->outputs = VERT_COLOR0_BIT;
+ stage->outputs = VERT_BIT_COLOR0;
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
- stage->outputs |= VERT_COLOR1_BIT;
+ stage->outputs |= VERT_BIT_COLOR1;
#endif
}
}
+/**
+ * Destructor for this pipeline stage.
+ */
static void dtr( struct gl_pipeline_stage *stage )
{
struct vp_stage_data *store = VP_STAGE_DATA(stage);
@@ -412,16 +451,19 @@ static void dtr( struct gl_pipeline_stage *stage )
}
}
+/**
+ * Public description of this pipeline stage.
+ */
const struct gl_pipeline_stage _tnl_vertex_program_stage =
{
"vertex-program",
_NEW_ALL, /*XXX FIX */ /* recheck */
_NEW_ALL, /*XXX FIX */ /* recalc -- modelview dependency
* otherwise not captured by inputs
- * (which may be VERT_OBJ_BIT) */
+ * (which may be VERT_BIT_POS) */
GL_FALSE, /* active */
- 0/*VERT_OBJ_BIT*/, /* inputs XXX OK? */
- VERT_CLIP | VERT_COLOR0_BIT, /* outputs XXX OK? */
+ /*0*/ VERT_BIT_POS, /* inputs XXX OK? */
+ VERT_BIT_CLIP | VERT_BIT_COLOR0, /* outputs XXX OK? */
0, /* changed_inputs */
NULL, /* private_data */
dtr, /* destroy */
diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c
index 794ef64705..5ccec25cb2 100644
--- a/src/mesa/tnl/t_vb_render.c
+++ b/src/mesa/tnl/t_vb_render.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_render.c,v 1.26 2001/12/17 01:46:58 brianp Exp $ */
+/* $Id: t_vb_render.c,v 1.27 2002/01/22 14:35:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -349,39 +349,39 @@ static GLboolean run_render( GLcontext *ctx,
*/
static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
{
- GLuint inputs = VERT_CLIP;
+ GLuint inputs = VERT_BIT_CLIP;
GLuint i;
if (ctx->Visual.rgbMode) {
- inputs |= VERT_COLOR0_BIT;
+ inputs |= VERT_BIT_COLOR0;
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_COLOR1_BIT;
+ inputs |= VERT_BIT_COLOR1;
if (ctx->Texture._ReallyEnabled) {
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
if (ctx->Texture.Unit[i]._ReallyEnabled)
- inputs |= VERT_TEX(i);
+ inputs |= VERT_BIT_TEX(i);
}
}
}
else {
- inputs |= VERT_INDEX_BIT;
+ inputs |= VERT_BIT_INDEX;
}
if (ctx->Point._Attenuated)
- inputs |= VERT_POINT_SIZE;
+ inputs |= VERT_BIT_POINT_SIZE;
/* How do drivers turn this off?
*/
if (ctx->Fog.Enabled)
- inputs |= VERT_FOG_BIT;
+ inputs |= VERT_BIT_FOG;
if (ctx->_TriangleCaps & DD_TRI_UNFILLED)
- inputs |= VERT_EDGEFLAG_BIT;
+ inputs |= VERT_BIT_EDGEFLAG;
if (ctx->RenderMode==GL_FEEDBACK)
- inputs |= VERT_TEX_ANY;
+ inputs |= VERT_BITS_TEX_ANY;
stage->inputs = inputs;
}
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index 62898ab599..f04d36c41a 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_texgen.c,v 1.11 2002/01/05 20:51:13 brianp Exp $ */
+/* $Id: t_vb_texgen.c,v 1.12 2002/01/22 14:35:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -529,7 +529,7 @@ static GLboolean run_texgen_stage( GLcontext *ctx,
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) {
- if (stage->changed_inputs & (VERT_EYE | VERT_NORMAL_BIT | VERT_TEX(i)))
+ if (stage->changed_inputs & (VERT_BIT_EYE | VERT_BIT_NORMAL | VERT_BIT_TEX(i)))
store->TexgenFunc[i]( ctx, store, i );
VB->TexCoordPtr[i] = &store->texcoord[i];
@@ -596,23 +596,23 @@ static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage )
GLuint outputs = 0;
if (ctx->Texture._GenFlags & TEXGEN_OBJ_LINEAR)
- inputs |= VERT_OBJ_BIT;
+ inputs |= VERT_BIT_POS;
if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD)
- inputs |= VERT_EYE;
+ inputs |= VERT_BIT_EYE;
if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS)
- inputs |= VERT_NORMAL_BIT;
+ inputs |= VERT_BIT_NORMAL;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i))
{
- outputs |= VERT_TEX(i);
+ outputs |= VERT_BIT_TEX(i);
/* Need the original input in case it contains a Q coord:
* (sigh)
*/
- inputs |= VERT_TEX(i);
+ inputs |= VERT_BIT_TEX(i);
/* Something for Feedback? */
}
diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c
index 8cff96a74a..135278d740 100644
--- a/src/mesa/tnl/t_vb_texmat.c
+++ b/src/mesa/tnl/t_vb_texmat.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_texmat.c,v 1.7 2001/12/18 04:06:46 brianp Exp $ */
+/* $Id: t_vb_texmat.c,v 1.8 2002/01/22 14:35:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -65,7 +65,7 @@ static void check_texmat( GLcontext *ctx, struct gl_pipeline_stage *stage )
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i))
- flags |= VERT_TEX(i);
+ flags |= VERT_BIT_TEX(i);
stage->active = 1;
stage->inputs = flags;
@@ -85,7 +85,7 @@ static GLboolean run_texmat_stage( GLcontext *ctx,
*/
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) {
- if (stage->changed_inputs & VERT_TEX(i))
+ if (stage->changed_inputs & VERT_BIT_TEX(i))
(void) TransformRaw( &store->texcoord[i],
ctx->TextureMatrixStack[i].Top,
VB->TexCoordPtr[i]);
diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c
index 8ceb9dbdaf..9026ec5144 100644
--- a/src/mesa/tnl/t_vb_vertex.c
+++ b/src/mesa/tnl/t_vb_vertex.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_vertex.c,v 1.11 2001/12/18 04:06:46 brianp Exp $ */
+/* $Id: t_vb_vertex.c,v 1.12 2002/01/22 14:35:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -172,7 +172,7 @@ static GLboolean run_vertex_stage( GLcontext *ctx,
if (VB->ClipPtr->size < 4) {
if (VB->ClipPtr->flags & VEC_NOT_WRITEABLE) {
ASSERT(VB->ClipPtr == VB->ObjPtr);
- VB->import_data( ctx, VERT_OBJ_BIT, VEC_NOT_WRITEABLE );
+ VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE );
VB->ClipPtr = VB->ObjPtr;
}
if (VB->ClipPtr->size == 2)
@@ -225,8 +225,8 @@ static GLboolean run_vertex_stage( GLcontext *ctx,
VB->ClipOrMask = store->ormask;
VB->ClipMask = store->clipmask;
- if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_OBJ_BIT))
- VB->importable_data |= VERT_CLIP;
+ if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_BIT_POS))
+ VB->importable_data |= VERT_BIT_CLIP;
store->save_eyeptr = VB->EyePtr;
store->save_clipptr = VB->ClipPtr;
@@ -240,8 +240,8 @@ static GLboolean run_vertex_stage( GLcontext *ctx,
VB->NdcPtr = store->save_ndcptr;
VB->ClipMask = store->clipmask;
VB->ClipOrMask = store->ormask;
- if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_OBJ_BIT))
- VB->importable_data |= VERT_CLIP;
+ if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_BIT_POS))
+ VB->importable_data |= VERT_BIT_CLIP;
if (store->andmask)
return GL_FALSE;
}
@@ -310,8 +310,8 @@ const struct gl_pipeline_stage _tnl_vertex_transform_stage =
_NEW_PROJECTION|
_NEW_TRANSFORM, /* re-run */
GL_TRUE, /* active */
- VERT_OBJ_BIT, /* inputs */
- VERT_EYE|VERT_CLIP, /* outputs */
+ VERT_BIT_POS, /* inputs */
+ VERT_BIT_EYE|VERT_BIT_CLIP, /* outputs */
0, /* changed_inputs */
NULL, /* private data */
dtr, /* destructor */
diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c
index 12021d70c4..867486d0b7 100644
--- a/src/mesa/x86/gen_matypes.c
+++ b/src/mesa/x86/gen_matypes.c
@@ -1,4 +1,4 @@
-/* $Id: gen_matypes.c,v 1.5 2001/12/18 04:06:45 brianp Exp $ */
+/* $Id: gen_matypes.c,v 1.6 2002/01/22 14:35:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -153,7 +153,7 @@ int main( int argc, char **argv )
DEFINE( "VERT_NORM ", VERT_NORMAL_BIT );
DEFINE( "VERT_RGBA ", VERT_COLOR0_BIT );
DEFINE( "VERT_SPEC_RGB ", VERT_COLOR1_BIT );
- DEFINE( "VERT_FOG_COORD ", VERT_FOG_BIT );
+ DEFINE( "VERT_FOG_COORD ", VERT_BIT_FOG );
DEFINE( "VERT_INDEX ", VERT_INDEX_BIT );
DEFINE( "VERT_EDGE ", VERT_EDGEFLAG_BIT );
DEFINE( "VERT_TEX0 ", VERT_TEX0_BIT );