summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-04-25 00:53:25 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-04-25 00:53:25 +0000
commit94b30dc390f1fdd526c080080830016fad3e2ee2 (patch)
tree92643c41eae15bcf373a9777ca04e73cfe46c7c3 /src/mesa/main
parent5bdc6fdebc0ab59a888fba15136eb4a0ee2790e1 (diff)
Put color index attribute into the 6th attribute slot.
Update a lot of loops, conditionals to use the _TNL_FIRST/LAST_* values instead of specific vertex attributes. Remove the EdgeFlagv function from the GLvertexformat struct.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_loopback.c11
-rw-r--r--src/mesa/main/api_noop.c11
-rw-r--r--src/mesa/main/context.c8
-rw-r--r--src/mesa/main/dd.h1
-rw-r--r--src/mesa/main/dlist.c7
-rw-r--r--src/mesa/main/get.c6
-rw-r--r--src/mesa/main/get_gen.py3
-rw-r--r--src/mesa/main/mtypes.h68
-rw-r--r--src/mesa/main/rastpos.c6
-rw-r--r--src/mesa/main/state.c12
-rw-r--r--src/mesa/main/vtxfmt.c1
-rw-r--r--src/mesa/main/vtxfmt_tmp.h7
12 files changed, 66 insertions, 75 deletions
diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index db30059e61..51d5af6f5f 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -281,6 +281,7 @@ loopback_Color4ubv_f( const GLubyte *v)
UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) );
}
+
static void GLAPIENTRY
loopback_FogCoorddEXT( GLdouble d )
{
@@ -342,6 +343,14 @@ loopback_Indexubv( const GLubyte *c )
INDEX( (GLfloat) *c );
}
+
+static void GLAPIENTRY
+loopback_EdgeFlagv(const GLboolean *flag)
+{
+ CALL_EdgeFlag(GET_DISPATCH(), (*flag));
+}
+
+
static void GLAPIENTRY
loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz )
{
@@ -1483,6 +1492,8 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest )
SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f);
SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f);
+ SET_EdgeFlagv(dest, loopback_EdgeFlagv);
+
SET_Indexd(dest, loopback_Indexd);
SET_Indexi(dest, loopback_Indexi);
SET_Indexs(dest, loopback_Indexs);
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index 2bc1a133ec..33d44e4329 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -48,22 +48,16 @@ static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b )
ctx->Current.EdgeFlag = b;
}
-static void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b )
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Current.EdgeFlag = *b;
-}
-
static void GLAPIENTRY _mesa_noop_Indexf( GLfloat f )
{
GET_CURRENT_CONTEXT(ctx);
- ctx->Current.Index = f;
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = f;
}
static void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- ctx->Current.Index = *v;
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = *v;
}
static void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a )
@@ -917,7 +911,6 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
vfmt->Color4f = _mesa_noop_Color4f;
vfmt->Color4fv = _mesa_noop_Color4fv;
vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
- vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
vfmt->End = _mesa_noop_End;
vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f;
vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 544a3036c6..36c5f2a689 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -913,18 +913,18 @@ _mesa_init_current( GLcontext *ctx )
{
GLuint i;
- /* Current group */
+ /* Init all to (0,0,0,1) */
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
ASSIGN_4V( ctx->Current.Attrib[i], 0.0, 0.0, 0.0, 1.0 );
}
- /* special cases: */
+
+ /* redo special cases: */
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 );
-
- ctx->Current.Index = 1;
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = 1.0;
ctx->Current.EdgeFlag = GL_TRUE;
}
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index b1c78f2232..4d9cea1e59 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -975,7 +975,6 @@ typedef struct {
void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
void (GLAPIENTRYP Color4fv)( const GLfloat * );
void (GLAPIENTRYP EdgeFlag)( GLboolean );
- void (GLAPIENTRYP EdgeFlagv)( const GLboolean * );
void (GLAPIENTRYP EvalCoord1f)( GLfloat ); /* NOTE */
void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); /* NOTE */
void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 790cace05c..cbf00f735e 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -5067,12 +5067,6 @@ save_EdgeFlag(GLboolean x)
}
static void GLAPIENTRY
-save_EdgeFlagv(const GLboolean * v)
-{
- save_EdgeFlag(v[0]);
-}
-
-static void GLAPIENTRY
save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
{
GET_CURRENT_CONTEXT(ctx);
@@ -8447,7 +8441,6 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
vfmt->Color4f = save_Color4f;
vfmt->Color4fv = save_Color4fv;
vfmt->EdgeFlag = save_EdgeFlag;
- vfmt->EdgeFlagv = save_EdgeFlagv;
vfmt->End = save_End;
vfmt->EvalCoord1f = save_EvalCoord1f;
vfmt->EvalCoord1fv = save_EvalCoord1fv;
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 9b322908d1..9684ccb8a4 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -230,7 +230,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
case GL_CURRENT_INDEX:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Index);
+ params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]);
}
break;
case GL_CURRENT_NORMAL:
@@ -2048,7 +2048,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
case GL_CURRENT_INDEX:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = ctx->Current.Index;
+ params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0];
}
break;
case GL_CURRENT_NORMAL:
@@ -3866,7 +3866,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
case GL_CURRENT_INDEX:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = IROUND(ctx->Current.Index);
+ params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]);
}
break;
case GL_CURRENT_NORMAL:
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 9dd6b8f79e..63aed5ab25 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -135,7 +135,8 @@ StateVars = [
"ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]",
"ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]" ],
"FLUSH_CURRENT(ctx, 0);", None ),
- ( "GL_CURRENT_INDEX", GLfloat, ["ctx->Current.Index"],
+ ( "GL_CURRENT_INDEX", GLfloat,
+ [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]" ],
"FLUSH_CURRENT(ctx, 0);", None ),
( "GL_CURRENT_NORMAL", GLfloatN,
[ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]",
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 244d1c64f8..e9e26d53f0 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -142,7 +142,7 @@ enum
VERT_ATTRIB_COLOR0 = 3,
VERT_ATTRIB_COLOR1 = 4,
VERT_ATTRIB_FOG = 5,
- VERT_ATTRIB_SIX = 6,
+ VERT_ATTRIB_COLOR_INDEX = 6,
VERT_ATTRIB_SEVEN = 7,
VERT_ATTRIB_TEX0 = 8,
VERT_ATTRIB_TEX1 = 9,
@@ -176,38 +176,38 @@ enum
* These are used in bitfields in many places.
*/
/*@{*/
-#define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
-#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
-#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
-#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
-#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
-#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
-#define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX)
-#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
-#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
-#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
-#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
-#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
-#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
-#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
-#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
-#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
-#define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0)
-#define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1)
-#define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2)
-#define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3)
-#define VERT_BIT_GENERIC4 (1 << VERT_ATTRIB_GENERIC4)
-#define VERT_BIT_GENERIC5 (1 << VERT_ATTRIB_GENERIC5)
-#define VERT_BIT_GENERIC6 (1 << VERT_ATTRIB_GENERIC6)
-#define VERT_BIT_GENERIC7 (1 << VERT_ATTRIB_GENERIC7)
-#define VERT_BIT_GENERIC8 (1 << VERT_ATTRIB_GENERIC8)
-#define VERT_BIT_GENERIC9 (1 << VERT_ATTRIB_GENERIC9)
-#define VERT_BIT_GENERIC10 (1 << VERT_ATTRIB_GENERIC10)
-#define VERT_BIT_GENERIC11 (1 << VERT_ATTRIB_GENERIC11)
-#define VERT_BIT_GENERIC12 (1 << VERT_ATTRIB_GENERIC12)
-#define VERT_BIT_GENERIC13 (1 << VERT_ATTRIB_GENERIC13)
-#define VERT_BIT_GENERIC14 (1 << VERT_ATTRIB_GENERIC14)
-#define VERT_BIT_GENERIC15 (1 << VERT_ATTRIB_GENERIC15)
+#define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
+#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
+#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
+#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
+#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
+#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
+#define VERT_BIT_COLOR_INDEX (1 << VERT_ATTRIB_COLOR_INDEX)
+#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
+#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
+#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
+#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
+#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
+#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
+#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
+#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
+#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
+#define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0)
+#define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1)
+#define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2)
+#define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3)
+#define VERT_BIT_GENERIC4 (1 << VERT_ATTRIB_GENERIC4)
+#define VERT_BIT_GENERIC5 (1 << VERT_ATTRIB_GENERIC5)
+#define VERT_BIT_GENERIC6 (1 << VERT_ATTRIB_GENERIC6)
+#define VERT_BIT_GENERIC7 (1 << VERT_ATTRIB_GENERIC7)
+#define VERT_BIT_GENERIC8 (1 << VERT_ATTRIB_GENERIC8)
+#define VERT_BIT_GENERIC9 (1 << VERT_ATTRIB_GENERIC9)
+#define VERT_BIT_GENERIC10 (1 << VERT_ATTRIB_GENERIC10)
+#define VERT_BIT_GENERIC11 (1 << VERT_ATTRIB_GENERIC11)
+#define VERT_BIT_GENERIC12 (1 << VERT_ATTRIB_GENERIC12)
+#define VERT_BIT_GENERIC13 (1 << VERT_ATTRIB_GENERIC13)
+#define VERT_BIT_GENERIC14 (1 << VERT_ATTRIB_GENERIC14)
+#define VERT_BIT_GENERIC15 (1 << VERT_ATTRIB_GENERIC15)
#define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u)))
#define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g)))
@@ -2566,7 +2566,7 @@ struct matrix_stack
#define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0
#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
-#define _NEW_ARRAY_INDEX VERT_BIT_SIX
+#define _NEW_ARRAY_INDEX VERT_BIT_COLOR_INDEX
#define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN
#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 507eb9f984..4f490db724 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -503,7 +503,8 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
}
else {
- ctx->Current.RasterIndex = ctx->Current.Index;
+ ctx->Current.RasterIndex
+ = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0];
}
}
@@ -756,7 +757,8 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z)
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F);
}
else {
- ctx->Current.RasterIndex = ctx->Current.Index;
+ ctx->Current.RasterIndex
+ = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0];
}
/* raster texcoord = current texcoord */
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 761a45f2bd..34eb2c3b8a 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -881,9 +881,13 @@ update_arrays( GLcontext *ctx )
/* 6 */
if (ctx->VertexProgram._Enabled
- && ctx->Array.VertexAttrib[VERT_ATTRIB_SIX].Enabled) {
- min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SIX]._MaxElement);
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX]._MaxElement);
}
+ else if (ctx->Array.Index.Enabled) {
+ min = MIN2(min, ctx->Array.Index._MaxElement);
+ }
+
/* 7 */
if (ctx->VertexProgram._Enabled
@@ -912,10 +916,6 @@ update_arrays( GLcontext *ctx )
}
}
- if (ctx->Array.Index.Enabled) {
- min = MIN2(min, ctx->Array.Index._MaxElement);
- }
-
if (ctx->Array.EdgeFlag.Enabled) {
min = MIN2(min, ctx->Array.EdgeFlag._MaxElement);
}
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index 99583a20da..0204979003 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -85,7 +85,6 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
SET_Color4f(tab, vfmt->Color4f);
SET_Color4fv(tab, vfmt->Color4fv);
SET_EdgeFlag(tab, vfmt->EdgeFlag);
- SET_EdgeFlagv(tab, vfmt->EdgeFlagv);
SET_EvalCoord1f(tab, vfmt->EvalCoord1f);
SET_EvalCoord1fv(tab, vfmt->EvalCoord1fv);
SET_EvalCoord2f(tab, vfmt->EvalCoord2f);
diff --git a/src/mesa/main/vtxfmt_tmp.h b/src/mesa/main/vtxfmt_tmp.h
index 2a0fdde466..783b06558d 100644
--- a/src/mesa/main/vtxfmt_tmp.h
+++ b/src/mesa/main/vtxfmt_tmp.h
@@ -68,12 +68,6 @@ static void GLAPIENTRY TAG(EdgeFlag)( GLboolean e )
CALL_EdgeFlag(GET_DISPATCH(), ( e ));
}
-static void GLAPIENTRY TAG(EdgeFlagv)( const GLboolean *v )
-{
- PRE_LOOPBACK( EdgeFlagv );
- CALL_EdgeFlagv(GET_DISPATCH(), ( v ));
-}
-
static void GLAPIENTRY TAG(EvalCoord1f)( GLfloat s )
{
PRE_LOOPBACK( EvalCoord1f );
@@ -467,7 +461,6 @@ static GLvertexformat TAG(vtxfmt) = {
TAG(Color4f),
TAG(Color4fv),
TAG(EdgeFlag),
- TAG(EdgeFlagv),
TAG(EvalCoord1f),
TAG(EvalCoord1fv),
TAG(EvalCoord2f),