cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
- cl->Ptr = (GLubyte *) &ctx->Current.Index;
+ cl->Ptr = (GLubyte *) &ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) );
}
+
static void GLAPIENTRY
loopback_FogCoorddEXT( GLdouble d )
{
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 )
{
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);
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 )
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;
{
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;
}
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 */
}
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);
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;
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:
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:
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:
"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]",
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,
* 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)))
#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
ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
}
else {
- ctx->Current.RasterIndex = ctx->Current.Index;
+ ctx->Current.RasterIndex
+ = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0];
}
}
= 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 */
/* 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
}
}
- if (ctx->Array.Index.Enabled) {
- min = MIN2(min, ctx->Array.Index._MaxElement);
- }
-
if (ctx->Array.EdgeFlag.Enabled) {
min = MIN2(min, ctx->Array.EdgeFlag._MaxElement);
}
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);
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 );
TAG(Color4f),
TAG(Color4fv),
TAG(EdgeFlag),
- TAG(EdgeFlagv),
TAG(EvalCoord1f),
TAG(EvalCoord1fv),
TAG(EvalCoord2f),
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ))
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4CHAN_4F_RGBA, specular);
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR_INDEX ))
+ EMIT_ATTR( _TNL_ATTRIB_COLOR_INDEX, EMIT_1F, index );
+
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG ))
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, fog);
}
}
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_INDEX ))
- EMIT_ATTR( _TNL_ATTRIB_INDEX, EMIT_1F, index );
-
if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE ))
EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize );
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp );
dest->fog = tmp[0];
- _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_INDEX, tmp );
- dest->index = (GLuint) tmp[0];
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR_INDEX, tmp );
+ dest->index = tmp[0];
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp );
dest->pointSize = tmp[0];
/* When vertex program mode is enabled, the generic vertex program
* attribute arrays have priority over the conventional attributes.
* Try to use them now.
+ * XXX that's true of NV_vertex_program, but ARB_vertex_program???
*/
for (index = 0; index < VERT_ATTRIB_MAX; index++) {
/* When vertex program mode is enabled, the generic vertex attribute
tmp->FogCoord.count = VB->Count;
VB->AttribPtr[_TNL_ATTRIB_FOG] = &tmp->FogCoord;
}
+ else if (index == VERT_ATTRIB_COLOR_INDEX) {
+ _tnl_import_index( ctx, 0, 0 );
+ tmp->Index.count = VB->Count;
+ VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX] = &tmp->Index;
+ }
else if (index >= VERT_ATTRIB_TEX0 && index <= VERT_ATTRIB_TEX7) {
i = index - VERT_ATTRIB_TEX0;
_tnl_import_texcoord( ctx, i, GL_FALSE, GL_FALSE );
/* odd-ball vertex attributes */
{
- _tnl_import_index( ctx, 0, 0 );
- tmp->Index.count = VB->Count;
- VB->AttribPtr[_TNL_ATTRIB_INDEX] = &tmp->Index;
- }
-
- {
_tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) );
VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag;
}
/* These are constant & could be precalculated:
*/
- for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; i < _TNL_ATTRIB_INDEX; i++) {
+ for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
_tnl_constant_attrib(tnl, tmp, i);
}
VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
VB->ColorPtr[1] = NULL;
- VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX];
+ VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX];
VB->IndexPtr[1] = NULL;
VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1];
VB->SecondaryColorPtr[1] = NULL;
}
else {
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
- RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_INDEX );
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR_INDEX );
}
if (ctx->Fog.Enabled ||
_TNL_ATTRIB_COLOR0 = 3,
_TNL_ATTRIB_COLOR1 = 4,
_TNL_ATTRIB_FOG = 5,
- _TNL_ATTRIB_SIX = 6,
+ _TNL_ATTRIB_COLOR_INDEX = 6,
_TNL_ATTRIB_SEVEN = 7,
_TNL_ATTRIB_TEX0 = 8,
_TNL_ATTRIB_TEX1 = 9,
_TNL_ATTRIB_MAT_BACK_SHININESS = 41,
_TNL_ATTRIB_MAT_FRONT_INDEXES = 42,
_TNL_ATTRIB_MAT_BACK_INDEXES = 43,
- _TNL_ATTRIB_INDEX = 44,
- _TNL_ATTRIB_EDGEFLAG = 45,
- _TNL_ATTRIB_POINTSIZE = 46,
- _TNL_ATTRIB_MAX = 47
+ _TNL_ATTRIB_EDGEFLAG = 44,
+ _TNL_ATTRIB_POINTSIZE = 45,
+ _TNL_ATTRIB_MAX = 46
} ;
#define _TNL_ATTRIB_TEX(u) (_TNL_ATTRIB_TEX0 + (u))
/* special index used for handing invalid glVertexAttribute() indices */
#define _TNL_ATTRIB_ERROR (_TNL_ATTRIB_ATTRIBUTE15 + 1)
-/* Define bit ranges instead of bit masks.
+/**
+ * Handy attribute ranges:
*/
#define _TNL_FIRST_PROG _TNL_ATTRIB_WEIGHT
#define _TNL_LAST_PROG _TNL_ATTRIB_TEX7
struct tnl_eval {
GLuint new_state;
- struct tnl_eval1_map map1[_TNL_ATTRIB_INDEX + 1];
- struct tnl_eval2_map map2[_TNL_ATTRIB_INDEX + 1];
+ struct tnl_eval1_map map1[_TNL_ATTRIB_EDGEFLAG + 1];
+ struct tnl_eval2_map map2[_TNL_ATTRIB_EDGEFLAG + 1];
};
* The GL_NV_vertex_program extension defines 16 extra sets of vertex
* arrays which have precedent over the conventional arrays when enabled.
*/
+ /* XXX I think the array size is wronge (47 vs. 16) */
GLvector4f Attribs[_TNL_ATTRIB_MAX];
};
GLuint PrimitiveCount;
/* Inputs to the vertex program stage */
+ /* XXX This array may be too large (47 vs. 16) */
GLvector4f *AttribPtr[_TNL_ATTRIB_MAX]; /* GL_NV_vertex_program */
};
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint i;
- for (i = 0; i < _TNL_ATTRIB_EDGEFLAG; i++) {
+ for (i = 0; i <= _TNL_LAST_MAT; i++) {
if (tnl->vb.AttribPtr[i]->size != tnl->pipeline.last_attrib_size[i] ||
tnl->vb.AttribPtr[i]->stride != tnl->pipeline.last_attrib_stride[i]) {
tnl->pipeline.last_attrib_size[i] = tnl->vb.AttribPtr[i]->size;
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint i;
- for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) {
+ /* XXX Use _TNL_FIRST_* and _TNL_LAST_* values instead? */
+ for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) {
if (tnl->save.attrsz[i]) {
tnl->save.currentsz[i][0] = tnl->save.attrsz[i];
COPY_CLEAN_4V(tnl->save.current[i],
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLint i;
- for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++)
+ for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++)
switch (tnl->save.attrsz[i]) {
case 4: tnl->save.attrptr[i][3] = tnl->save.current[i][3];
case 3: tnl->save.attrptr[i][2] = tnl->save.current[i][2];
IDX_ATTR( _TNL_ATTRIB_EDGEFLAG, (GLfloat)b );
}
-static void GLAPIENTRY _save_EdgeFlagv( const GLboolean *v )
-{
- IDX_ATTR( _TNL_ATTRIB_EDGEFLAG, (GLfloat)(v[0]) );
-}
static void GLAPIENTRY _save_Indexf( GLfloat f )
{
- IDX_ATTR( _TNL_ATTRIB_INDEX, f );
+ IDX_ATTR( _TNL_ATTRIB_COLOR_INDEX, f );
}
static void GLAPIENTRY _save_Indexfv( const GLfloat *f )
{
- IDX_ATTR( _TNL_ATTRIB_INDEX, f[0] );
+ IDX_ATTR( _TNL_ATTRIB_COLOR_INDEX, f[0] );
}
vfmt->Color4f = _save_Color4f;
vfmt->Color4fv = _save_Color4fv;
vfmt->EdgeFlag = _save_EdgeFlag;
- vfmt->EdgeFlagv = _save_EdgeFlagv;
vfmt->End = _save_End;
vfmt->FogCoordfEXT = _save_FogCoordfEXT;
vfmt->FogCoordfvEXT = _save_FogCoordfvEXT;
tnl->save.current[i] = ctx->ListState.CurrentAttrib[i];
}
- for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; i < _TNL_ATTRIB_INDEX; i++) {
- const GLuint j = i - _TNL_ATTRIB_MAT_FRONT_AMBIENT;
+ for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
+ const GLuint j = i - _TNL_FIRST_MAT;
ASSERT(j < MAT_ATTRIB_MAX);
tnl->save.currentsz[i] = &ctx->ListState.ActiveMaterialSize[j];
tnl->save.current[i] = ctx->ListState.CurrentMaterial[j];
}
- tnl->save.currentsz[_TNL_ATTRIB_INDEX] = &ctx->ListState.ActiveIndex;
- tnl->save.current[_TNL_ATTRIB_INDEX] = &ctx->ListState.CurrentIndex;
-
tnl->save.currentsz[_TNL_ATTRIB_EDGEFLAG] = &ctx->ListState.ActiveEdgeFlag;
tnl->save.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->save.CurrentFloatEdgeFlag;
}
struct loopback_attr la[_TNL_ATTRIB_MAX];
GLuint i, nr = 0;
- for (i = 0 ; i <= _TNL_ATTRIB_TEX7 ; i++) {
+ /* conventional + generic attributes */
+ for (i = 0 ; i <= _TNL_ATTRIB_ATTRIBUTE15 ; i++) {
if (list->attrsz[i]) {
la[nr].target = i;
la[nr].sz = list->attrsz[i];
}
}
+ /* material attributes */
for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ;
i <= _TNL_ATTRIB_MAT_BACK_INDEXES ;
i++) {
}
}
+ /* special-case: edgeflag */
if (list->attrsz[_TNL_ATTRIB_EDGEFLAG]) {
la[nr].target = _TNL_ATTRIB_EDGEFLAG;
la[nr].sz = list->attrsz[_TNL_ATTRIB_EDGEFLAG];
nr++;
}
- if (list->attrsz[_TNL_ATTRIB_INDEX]) {
- la[nr].target = _TNL_ATTRIB_INDEX;
- la[nr].sz = list->attrsz[_TNL_ATTRIB_INDEX];
- la[nr].func = index_attr1fv;
- nr++;
- }
-
- /* XXX ARB vertex attribs */
-
for (i = 0 ; i < list->prim_count ; i++) {
if (list->prim[i].mode & PRIM_WEAK)
loopback_weak_prim( ctx, list, i, la, nr );
VB->Elts = NULL;
VB->NormalLengthPtr = node->normal_lengths;
- for (attr = 0; attr <= _TNL_ATTRIB_INDEX; attr++) {
+ for (attr = 0; attr <= _TNL_ATTRIB_EDGEFLAG; attr++) {
if (node->attrsz[attr]) {
tmp->Attribs[attr].count = node->count;
tmp->Attribs[attr].data = (GLfloat (*)[4]) data;
VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
VB->ColorPtr[1] = NULL;
- VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX];
+ VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX];
VB->IndexPtr[1] = NULL;
VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1];
VB->SecondaryColorPtr[1] = NULL;
else
data = node->buffer;
- for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) {
+ for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) {
if (node->attrsz[i]) {
COPY_CLEAN_4V(tnl->vtx.current[i], node->attrsz[i], data);
data += node->attrsz[i];
* update_materials(), above, that'll actually copy the vertex color to
* the material attribute(s).
*/
- for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i < _TNL_ATTRIB_INDEX ; i++) {
+ for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
if (VB->AttribPtr[i]->stride) {
const GLuint j = store->mat_count++;
const GLuint attr = i - _TNL_ATTRIB_MAT_FRONT_AMBIENT;
VB->AttribPtr[_TNL_ATTRIB_COLOR0] = VB->ColorPtr[0];
VB->AttribPtr[_TNL_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0];
- VB->AttribPtr[_TNL_ATTRIB_INDEX] = VB->IndexPtr[0];
+ VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX] = VB->IndexPtr[0];
return GL_TRUE;
}
key->light_color_material_mask = ctx->Light.ColorMaterialBitmask;
}
- for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i < _TNL_ATTRIB_INDEX ; i++)
+ for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++)
if (VB->AttribPtr[i]->stride)
key->light_material_mask |= 1<<(i-_TNL_ATTRIB_MAT_FRONT_AMBIENT);
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint i;
- for (i = _TNL_ATTRIB_POS+1 ; i < _TNL_ATTRIB_INDEX ; i++) {
+ for (i = _TNL_ATTRIB_POS+1 ; i < _TNL_ATTRIB_EDGEFLAG ; i++) {
if (tnl->vtx.attrsz[i]) {
/* Note: the tnl->vtx.current[i] pointers points to
* the ctx->Current fields. The first 16 or so, anyway.
}
}
- /* color index is special (it's not a float[4] so COPY_CLEAN_4V above
- * will trash adjacent memory!)
- */
- if (tnl->vtx.attrsz[_TNL_ATTRIB_INDEX]) {
- ctx->Current.Index = tnl->vtx.attrptr[_TNL_ATTRIB_INDEX][0];
- }
-
/* Edgeflag requires additional treatment:
*/
if (tnl->vtx.attrsz[_TNL_ATTRIB_EDGEFLAG]) {
OTHER_ATTR( _TNL_ATTRIB_EDGEFLAG, 1, &f );
}
-static void GLAPIENTRY _tnl_EdgeFlagv( const GLboolean *v )
-{
- GET_CURRENT_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLfloat f = (GLfloat)v[0];
-
- OTHER_ATTR( _TNL_ATTRIB_EDGEFLAG, 1, &f );
-}
-
-static void GLAPIENTRY _tnl_Indexf( GLfloat f )
-{
- GET_CURRENT_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- OTHER_ATTR( _TNL_ATTRIB_INDEX, 1, &f );
-}
-
-static void GLAPIENTRY _tnl_Indexfv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- OTHER_ATTR( _TNL_ATTRIB_INDEX, 1, v );
-}
/* Eval
*/
if (tnl->vtx.eval.new_state)
_tnl_update_eval( ctx );
- for (i = 0 ; i <= _TNL_ATTRIB_INDEX ; i++) {
+ for (i = 0 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) {
if (tnl->vtx.eval.map1[i].map)
if (tnl->vtx.attrsz[i] != tnl->vtx.eval.map1[i].sz)
_tnl_fixup_vertex( ctx, i, tnl->vtx.eval.map1[i].sz );
if (tnl->vtx.eval.new_state)
_tnl_update_eval( ctx );
- for (i = 0 ; i <= _TNL_ATTRIB_INDEX ; i++) {
+ for (i = 0 ; i <= _TNL_ATTRIB_EDGEFLAG ; i++) {
if (tnl->vtx.eval.map2[i].map)
if (tnl->vtx.attrsz[i] != tnl->vtx.eval.map2[i].sz)
_tnl_fixup_vertex( ctx, i, tnl->vtx.eval.map2[i].sz );
}
+/**
+ * XXX why aren't all members initialized here??
+ */
static void _tnl_exec_vtxfmt_init( GLcontext *ctx )
{
GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->exec_vtxfmt);
vfmt->CallList = _mesa_CallList;
vfmt->CallLists = _mesa_CallLists;
vfmt->EdgeFlag = _tnl_EdgeFlag;
- vfmt->EdgeFlagv = _tnl_EdgeFlagv;
vfmt->End = _tnl_End;
vfmt->EvalCoord1f = _tnl_EvalCoord1f;
vfmt->EvalCoord1fv = _tnl_EvalCoord1fv;
vfmt->EvalCoord2fv = _tnl_EvalCoord2fv;
vfmt->EvalPoint1 = _tnl_EvalPoint1;
vfmt->EvalPoint2 = _tnl_EvalPoint2;
- vfmt->Indexf = _tnl_Indexf;
- vfmt->Indexfv = _tnl_Indexfv;
vfmt->Materialfv = _tnl_Materialfv;
vfmt->Rectf = _mesa_noop_Rectf;
tnl->vtx.current[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] =
ctx->Light.Material.Attrib[i];
- /* special cases */
- tnl->vtx.current[_TNL_ATTRIB_INDEX] = &ctx->Current.Index;
+ /* special case */
tnl->vtx.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->vtx.CurrentFloatEdgeFlag;
}
_tnl_generic_attr_table_init( generic_attr_func );
}
- for (i = 0; i < _TNL_ATTRIB_INDEX; i++)
+ for (i = 0; i < _TNL_ATTRIB_EDGEFLAG; i++)
_mesa_vector4f_init( &tmp->Attribs[i], 0, NULL);
for (i = 0; i < 4; i++) {
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint attr;
- for (attr = 1; attr <= _TNL_ATTRIB_INDEX; attr++) {
+ for (attr = 1; attr <= _TNL_ATTRIB_EDGEFLAG; attr++) {
struct gl_1d_map *map = tnl->vtx.eval.map1[attr].map;
if (map) {
GLfloat uu = (u - map->u1) * map->du;
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint attr;
- for (attr = 1; attr <= _TNL_ATTRIB_INDEX; attr++) {
+ for (attr = 1; attr <= _TNL_ATTRIB_EDGEFLAG; attr++) {
struct gl_2d_map *map = tnl->vtx.eval.map2[attr].map;
if (map) {
GLfloat uu = (u - map->u1) * map->du;
VB->Elts = NULL;
VB->NormalLengthPtr = NULL;
- for (attr = 0; attr <= _TNL_ATTRIB_INDEX ; attr++) {
+ for (attr = 0; attr <= _TNL_ATTRIB_EDGEFLAG ; attr++) {
if (tnl->vtx.attrsz[attr]) {
tmp->Attribs[attr].count = count;
tmp->Attribs[attr].data = (GLfloat (*)[4]) data;
VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
VB->ColorPtr[1] = NULL;
- VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX];
- VB->IndexPtr[1] = NULL;
VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1];
VB->SecondaryColorPtr[1] = NULL;
+ VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX];
+ VB->IndexPtr[1] = NULL;
VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG];
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
DISPATCH_ATTR4FV( _TNL_ATTRIB_COLOR0, v );
}
+static void GLAPIENTRY _tnl_Indexf( GLfloat v )
+{
+ DISPATCH_ATTR1F( _TNL_ATTRIB_COLOR_INDEX, v );
+}
+
+static void GLAPIENTRY _tnl_Indexfv( const GLfloat *v )
+{
+ DISPATCH_ATTR1FV( _TNL_ATTRIB_COLOR_INDEX, v );
+}
+
static void GLAPIENTRY _tnl_SecondaryColor3fEXT( GLfloat x, GLfloat y,
GLfloat z )
{
vfmt->Color3fv = _tnl_Color3fv;
vfmt->Color4f = _tnl_Color4f;
vfmt->Color4fv = _tnl_Color4fv;
+ vfmt->Indexf = _tnl_Indexf;
+ vfmt->Indexfv = _tnl_Indexfv;
vfmt->FogCoordfEXT = _tnl_FogCoordfEXT;
vfmt->FogCoordfvEXT = _tnl_FogCoordfvEXT;
vfmt->MultiTexCoord1fARB = _tnl_MultiTexCoord1f;