just aliases for members of the VB->AttribPtr[] array.
Begin replacing FogCoordPtr with VB->AttribPtr[_TNL_ATTRIB_FOG], and similarly
for NormalPtr, TexCoordPtr, PointSizePtr, etc.
GLvector4f *IndexPtr[2]; /* _TNL_BIT_INDEX */
GLvector4f *ColorPtr[2]; /* _TNL_BIT_COLOR0 */
GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */
- GLvector4f *PointSizePtr; /* _TNL_BIT_POS */
GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */
GLvector4f *VaryingPtr[MAX_VARYING_VECTORS];
VB->ClipPtr = &m->attribs[VERT_RESULT_HPOS];
VB->ClipPtr->count = VB->Count;
+ /* XXX There seems to be confusion between using the VERT_ATTRIB_*
+ * values vs _TNL_ATTRIB_* tokens here:
+ */
outputs = program->Base.OutputsWritten;
if (program->IsPositionInvariant)
outputs |= (1<<VERT_RESULT_HPOS);
if (outputs & (1<<VERT_RESULT_COL0)) {
- VB->ColorPtr[0] = &m->attribs[VERT_RESULT_COL0];
- VB->AttribPtr[VERT_ATTRIB_COLOR0] = VB->ColorPtr[0];
+ VB->ColorPtr[0] =
+ VB->AttribPtr[VERT_ATTRIB_COLOR0] = &m->attribs[VERT_RESULT_COL0];
}
if (outputs & (1<<VERT_RESULT_BFC0)) {
}
if (outputs & (1<<VERT_RESULT_COL1)) {
- VB->SecondaryColorPtr[0] = &m->attribs[VERT_RESULT_COL1];
- VB->AttribPtr[VERT_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0];
+ VB->SecondaryColorPtr[0] =
+ VB->AttribPtr[VERT_ATTRIB_COLOR1] = &m->attribs[VERT_RESULT_COL1];
}
if (outputs & (1<<VERT_RESULT_BFC1)) {
}
if (outputs & (1<<VERT_RESULT_FOGC)) {
- VB->FogCoordPtr = &m->attribs[VERT_RESULT_FOGC];
- VB->AttribPtr[VERT_ATTRIB_FOG] = VB->FogCoordPtr;
+ VB->FogCoordPtr =
+ VB->AttribPtr[VERT_ATTRIB_FOG] = &m->attribs[VERT_RESULT_FOGC];
}
if (outputs & (1<<VERT_RESULT_PSIZ)) {
- VB->PointSizePtr = &m->attribs[VERT_RESULT_PSIZ];
VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &m->attribs[VERT_RESULT_PSIZ];
}
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
if (outputs & (1<<(VERT_RESULT_TEX0+i))) {
- VB->TexCoordPtr[i] = &m->attribs[VERT_RESULT_TEX0 + i];
- VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i];
+ VB->TexCoordPtr[i] =
+ VB->AttribPtr[VERT_ATTRIB_TEX0+i] = &m->attribs[VERT_RESULT_TEX0 + i];
}
}
VEC_ELT(VB->ClipPtr, GLfloat, i)[1],
VEC_ELT(VB->ClipPtr, GLfloat, i)[2],
VEC_ELT(VB->ClipPtr, GLfloat, i)[3],
- VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[0],
- VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[1],
- VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[2],
- VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[3]);
+ VEC_ELT(VB->AttribPtr[VERT_ATTRIB_TEX0], GLfloat, i)[0],
+ VEC_ELT(VB->AttribPtr[VERT_ATTRIB_TEX0], GLfloat, i)[1],
+ VEC_ELT(VB->AttribPtr[VERT_ATTRIB_TEX0], GLfloat, i)[2],
+ VEC_ELT(VB->AttribPtr[VERT_ATTRIB_TEX0], GLfloat, i)[3]);
}
#endif
vb->ClipPtr = &store->outputs[VERT_RESULT_HPOS];
vb->ClipPtr->count = vb->Count;
+
vb->ColorPtr[0] = &store->outputs[VERT_RESULT_COL0];
- vb->SecondaryColorPtr[0] = &store->outputs[VERT_RESULT_COL1];
- for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++)
- vb->TexCoordPtr[i] = &store->outputs[VERT_RESULT_TEX0 + i];
+ vb->AttribPtr[VERT_ATTRIB_COLOR0] = vb->ColorPtr[0];
vb->ColorPtr[1] = &store->outputs[VERT_RESULT_BFC0];
+
+ vb->SecondaryColorPtr[0] =
+ vb->AttribPtr[VERT_ATTRIB_COLOR1] = &store->outputs[VERT_RESULT_COL1];
+
vb->SecondaryColorPtr[1] = &store->outputs[VERT_RESULT_BFC1];
- vb->FogCoordPtr = &store->outputs[VERT_RESULT_FOGC];
- vb->PointSizePtr = &store->outputs[VERT_RESULT_PSIZ];
- for (i = 0; i < MAX_VARYING_VECTORS; i++)
- vb->VaryingPtr[i] = &store->varyings[i];
- vb->AttribPtr[VERT_ATTRIB_COLOR0] = vb->ColorPtr[0];
- vb->AttribPtr[VERT_ATTRIB_COLOR1] = vb->SecondaryColorPtr[0];
- vb->AttribPtr[VERT_ATTRIB_FOG] = vb->FogCoordPtr;
- for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++)
- vb->AttribPtr[VERT_ATTRIB_TEX0 + i] = vb->TexCoordPtr[i];
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
+ vb->TexCoordPtr[i] =
+ vb->AttribPtr[VERT_ATTRIB_TEX0 + i] = &store->outputs[VERT_RESULT_TEX0 + i];
+ }
+
+ vb->FogCoordPtr =
+ vb->AttribPtr[VERT_ATTRIB_FOG] = &store->outputs[VERT_RESULT_FOGC];
+
vb->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->outputs[VERT_RESULT_PSIZ];
- for (i = 0; i < MAX_VARYING_VECTORS; i++)
+
+ for (i = 0; i < MAX_VARYING_VECTORS; i++) {
+ vb->VaryingPtr[i] = &store->varyings[i];
vb->AttribPtr[_TNL_ATTRIB_GENERIC0 + i] = vb->VaryingPtr[i];
+ }
store->ormask = 0;
store->andmask = CLIP_FRUSTUM_BITS;
const GLfloat a = ctx->Transform.CullObjPos[0];
const GLfloat b = ctx->Transform.CullObjPos[1];
const GLfloat c = ctx->Transform.CullObjPos[2];
- GLfloat *norm = (GLfloat *)VB->NormalPtr->data;
- GLuint stride = VB->NormalPtr->stride;
+ GLfloat *norm = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
+ GLuint stride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
GLuint count = VB->Count;
GLuint i;
if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) {
/* Fog is computed from vertex or fragment Z values */
/* source = VB->ObjPtr or VB->EyePtr coords */
- /* dest = VB->FogCoordPtr = fog stage private storage */
- VB->FogCoordPtr = &store->fogcoord;
+ /* dest = VB->AttribPtr[_TNL_ATTRIB_FOG] = fog stage private storage */
+ VB->AttribPtr[_TNL_ATTRIB_FOG] = &store->fogcoord;
if (!ctx->_NeedEyeCoords) {
/* compute fog coords from object coords */
}
else {
/* use glFogCoord() coordinates */
- input = VB->FogCoordPtr; /* source data */
+ input = VB->AttribPtr[_TNL_ATTRIB_FOG]; /* source data */
/* input->count may be one if glFogCoord was only called once
* before glBegin. But we need to compute fog for all vertices.
*/
input->count = VB->ObjPtr->count;
- VB->FogCoordPtr = &store->fogcoord; /* dest data */
+ VB->AttribPtr[_TNL_ATTRIB_FOG] = &store->fogcoord; /* dest data */
}
if (tnl->_DoVertexFog) {
/* compute blend factors from fog coordinates */
- compute_fog_blend_factors( ctx, VB->FogCoordPtr, input );
+ compute_fog_blend_factors( ctx, VB->AttribPtr[_TNL_ATTRIB_FOG], input );
}
else {
/* results = incoming fog coords (compute fog per-fragment later) */
- VB->FogCoordPtr = input;
+ VB->AttribPtr[_TNL_ATTRIB_FOG] = input;
}
- VB->AttribPtr[_TNL_ATTRIB_FOG] = VB->FogCoordPtr;
+ VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG];
return GL_TRUE;
}
const GLuint vstride = input->stride;
const GLfloat *vertex = (GLfloat *)input->data;
- const GLuint nstride = VB->NormalPtr->stride;
- const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
+ const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+ const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
GLfloat (*Fspec)[4] = (GLfloat (*)[4]) store->LitSecondary[0].data;
const GLuint vstride = input->stride;
const GLfloat *vertex = (GLfloat *) input->data;
- const GLuint nstride = VB->NormalPtr->stride;
- const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
+ const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+ const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
#if IDX & LIGHT_TWOSIDE
{
struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
- const GLuint nstride = VB->NormalPtr->stride;
- const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
+ const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+ const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
#if IDX & LIGHT_TWOSIDE
GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
#if IDX & LIGHT_MATERIAL
const GLuint nr = VB->Count;
#else
- const GLuint nr = VB->NormalPtr->count;
+ const GLuint nr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count;
#endif
#ifdef TRACE
{
struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
GLfloat sumA[2];
- const GLuint nstride = VB->NormalPtr->stride;
- const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
+ const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+ const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
#if IDX & LIGHT_TWOSIDE
GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
#if IDX & LIGHT_MATERIAL
const GLuint nr = VB->Count;
#else
- const GLuint nr = VB->NormalPtr->count;
+ const GLuint nr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count;
#endif
const struct gl_light *light;
GLuint j;
const GLuint vstride = input->stride;
const GLfloat *vertex = (GLfloat *) input->data;
- const GLuint nstride = VB->NormalPtr->stride;
- const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
+ const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+ const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
GLfloat *indexResult[2];
const GLuint nr = VB->Count;
store->NormalTransform( ctx->ModelviewMatrixStack.Top,
ctx->_ModelViewInvScale,
- VB->NormalPtr, /* input normals */
+ VB->AttribPtr[_TNL_ATTRIB_NORMAL], /* input normals */
lengths,
&store->normal ); /* resulting normals */
- if (VB->NormalPtr->count > 1) {
+ if (VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count > 1) {
store->normal.stride = 4 * sizeof(GLfloat);
}
else {
store->normal.stride = 0;
}
+ VB->AttribPtr[_TNL_ATTRIB_NORMAL] = &store->normal;
VB->NormalPtr = &store->normal;
- VB->AttribPtr[_TNL_ATTRIB_NORMAL] = VB->NormalPtr;
VB->NormalLengthPtr = NULL; /* no longer valid */
return GL_TRUE;
size[i][0] = pointSize * atten; /* clamping done in rasterization */
}
- VB->PointSizePtr = &store->PointSize;
VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->PointSize;
}
VB->SecondaryColorPtr[0] = &store->attribs[VERT_RESULT_COL1];
VB->SecondaryColorPtr[1] = &store->attribs[VERT_RESULT_BFC1];
VB->FogCoordPtr = &store->attribs[VERT_RESULT_FOGC];
- VB->PointSizePtr = &store->attribs[VERT_RESULT_PSIZ];
- VB->AttribPtr[VERT_ATTRIB_COLOR0] = VB->ColorPtr[0];
- VB->AttribPtr[VERT_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0];
- VB->AttribPtr[VERT_ATTRIB_FOG] = VB->FogCoordPtr;
+ VB->AttribPtr[VERT_ATTRIB_COLOR0] = &store->attribs[VERT_RESULT_COL0];
+ VB->AttribPtr[VERT_ATTRIB_COLOR1] = &store->attribs[VERT_RESULT_COL1];
+ VB->AttribPtr[VERT_ATTRIB_FOG] = &store->attribs[VERT_RESULT_FOGC];
VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->attribs[VERT_RESULT_PSIZ];
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] =
- &store->attribs[VERT_RESULT_TEX0 + i];
+ VB->TexCoordPtr[i] =
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]
+ = &store->attribs[VERT_RESULT_TEX0 + i];
}
-
-
/* Cliptest and perspective divide. Clip functions must clear
* the clipmask.
*/
GLuint unit )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLvector4f *in = VB->TexCoordPtr[unit];
+ GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit];
GLvector4f *out = &store->texcoord[unit];
build_f_tab[VB->EyePtr->size]( out->start,
out->stride,
- VB->NormalPtr,
+ VB->AttribPtr[_TNL_ATTRIB_NORMAL],
VB->EyePtr );
out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3;
GLuint unit )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLvector4f *in = VB->TexCoordPtr[unit];
+ GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit];
GLvector4f *out = &store->texcoord[unit];
- GLvector4f *normal = VB->NormalPtr;
+ GLvector4f *normal = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start;
GLuint count = VB->Count;
GLuint i;
GLuint unit )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLvector4f *in = VB->TexCoordPtr[unit];
+ GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit];
GLvector4f *out = &store->texcoord[unit];
GLfloat (*texcoord)[4] = (GLfloat (*)[4]) out->start;
GLuint count = VB->Count;
(build_m_tab[VB->EyePtr->size])( store->tmp_f,
store->tmp_m,
- VB->NormalPtr,
+ VB->AttribPtr[_TNL_ATTRIB_NORMAL],
VB->EyePtr );
out->size = MAX2(in->size,2);
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLvector4f *in = VB->TexCoordPtr[unit];
+ GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit];
GLvector4f *out = &store->texcoord[unit];
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
const GLvector4f *obj = VB->ObjPtr;
const GLvector4f *eye = VB->EyePtr;
- const GLvector4f *normal = VB->NormalPtr;
+ const GLvector4f *normal = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
const GLfloat *m = store->tmp_m;
const GLuint count = VB->Count;
GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data;
store->TexgenFunc[i]( ctx, store, i );
- VB->AttribPtr[VERT_ATTRIB_TEX0+i] =
- VB->TexCoordPtr[i] = &store->texcoord[i];
+ VB->TexCoordPtr[i] =
+ VB->AttribPtr[VERT_ATTRIB_TEX0 + i] = &store->texcoord[i];
}
}
if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) {
(void) TransformRaw( &store->texcoord[i],
ctx->TextureMatrixStack[i].Top,
- VB->TexCoordPtr[i]);
+ VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]);
- VB->AttribPtr[VERT_ATTRIB_TEX0+i] =
- VB->TexCoordPtr[i] = &store->texcoord[i];
+ VB->TexCoordPtr[i] =
+ VB->AttribPtr[VERT_ATTRIB_TEX0+i] = &store->texcoord[i];
}
}