struct vbo_save_context *save = &vbo_context(ctx)->save;
GLuint i;
- for (i = VBO_ATTRIB_POS+1 ; i <= VBO_ATTRIB_INDEX ; i++) {
+ for (i = VBO_ATTRIB_POS+1 ; i < VBO_ATTRIB_MAX ; i++) {
if (save->attrsz[i]) {
save->currentsz[i][0] = save->attrsz[i];
COPY_CLEAN_4V(save->current[i],
- save->attrsz[i],
- save->attrptr[i]);
+ save->attrsz[i],
+ save->attrptr[i]);
}
}
-
- /* Edgeflag requires special treatment:
- *
- * TODO: change edgeflag to GLfloat in Mesa.
- */
- if (save->attrsz[VBO_ATTRIB_EDGEFLAG]) {
- ctx->ListState.ActiveEdgeFlag = 1;
- save->CurrentFloatEdgeFlag =
- save->attrptr[VBO_ATTRIB_EDGEFLAG][0];
- ctx->ListState.CurrentEdgeFlag =
- (save->CurrentFloatEdgeFlag == 1.0);
- }
}
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLint i;
- for (i = VBO_ATTRIB_POS+1 ; i <= VBO_ATTRIB_INDEX ; i++)
+ for (i = VBO_ATTRIB_POS+1 ; i < VBO_ATTRIB_MAX ; i++) {
switch (save->attrsz[i]) {
case 4: save->attrptr[i][3] = save->current[i][3];
case 3: save->attrptr[i][2] = save->current[i][2];
case 1: save->attrptr[i][0] = save->current[i][0];
case 0: break;
}
-
- /* Edgeflag requires special treatment:
- */
- if (save->attrsz[VBO_ATTRIB_EDGEFLAG]) {
- save->CurrentFloatEdgeFlag = (GLfloat)ctx->ListState.CurrentEdgeFlag;
- save->attrptr[VBO_ATTRIB_EDGEFLAG][0] = save->CurrentFloatEdgeFlag;
}
}
if (save->active_sz[A] != N) \
save_fixup_vertex(ctx, A, N); \
\
+ _mesa_printf("Attr %d, sz %d: %f %f %f %f\n", A, N, V0, V1, V2, V3 ); \
+ \
{ \
GLfloat *dest = save->attrptr[A]; \
if (N>0) dest[0] = V0; \
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLint i;
- for (i = 0; i < VBO_ATTRIB_FIRST_MATERIAL; i++) {
- save->currentsz[i] = &ctx->ListState.ActiveAttribSize[i];
- save->current[i] = ctx->ListState.CurrentAttrib[i];
+ for (i = VBO_ATTRIB_POS; i <= VBO_ATTRIB_GENERIC15; i++) {
+ const GLuint j = i - VBO_ATTRIB_POS;
+ ASSERT(j < VERT_ATTRIB_MAX);
+ save->currentsz[i] = &ctx->ListState.ActiveAttribSize[j];
+ save->current[i] = ctx->ListState.CurrentAttrib[j];
}
- for (i = VBO_ATTRIB_FIRST_MATERIAL; i < VBO_ATTRIB_INDEX; i++) {
+ for (i = VBO_ATTRIB_FIRST_MATERIAL; i <= VBO_ATTRIB_MAT_FRONT_AMBIENT; i++) {
const GLuint j = i - VBO_ATTRIB_FIRST_MATERIAL;
ASSERT(j < MAT_ATTRIB_MAX);
save->currentsz[i] = &ctx->ListState.ActiveMaterialSize[j];
save->current[i] = ctx->ListState.CurrentMaterial[j];
}
-
- save->currentsz[VBO_ATTRIB_INDEX] = &ctx->ListState.ActiveIndex;
- save->current[VBO_ATTRIB_INDEX] = &ctx->ListState.CurrentIndex;
-
- save->currentsz[VBO_ATTRIB_EDGEFLAG] = &ctx->ListState.ActiveEdgeFlag;
- save->current[VBO_ATTRIB_EDGEFLAG] = &save->CurrentFloatEdgeFlag;
}
/**
typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * );
-/* Wrapper functions in case glVertexAttrib*fvNV doesn't exist */
+/* This file makes heavy use of the aliasing of NV vertex attributes
+ * with the legacy attributes.
+ */
static void VertexAttrib1fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib1fvNV(ctx->Exec, (target, v));
VertexAttrib4fvNV
};
-#if 0
-static void VertexAttrib1fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib1fvARB(ctx->Exec, (target, v));
-}
-
-static void VertexAttrib2fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib2fvARB(ctx->Exec, (target, v));
-}
-
-static void VertexAttrib3fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib3fvARB(ctx->Exec, (target, v));
-}
-
-static void VertexAttrib4fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib4fvARB(ctx->Exec, (target, v));
-}
-
-
-static attr_func vert_attrfunc_arb[4] = {
- VertexAttrib1fvARB,
- VertexAttrib2fvARB,
- VertexAttrib3fvARB,
- VertexAttrib4fvARB
-};
-#endif
-
-
-
-
-
-
-static void mat_attr1fv( GLcontext *ctx, GLint target, const GLfloat *v )
-{
- switch (target) {
- case VBO_ATTRIB_MAT_FRONT_SHININESS:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SHININESS, v ));
- break;
- case VBO_ATTRIB_MAT_BACK_SHININESS:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SHININESS, v ));
- break;
- }
-}
-
-
-static void mat_attr3fv( GLcontext *ctx, GLint target, const GLfloat *v )
-{
- switch (target) {
- case VBO_ATTRIB_MAT_FRONT_INDEXES:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_COLOR_INDEXES, v ));
- break;
- case VBO_ATTRIB_MAT_BACK_INDEXES:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_COLOR_INDEXES, v ));
- break;
- }
-}
-
-
-static void mat_attr4fv( GLcontext *ctx, GLint target, const GLfloat *v )
-{
- switch (target) {
- case VBO_ATTRIB_MAT_FRONT_EMISSION:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_EMISSION, v ));
- break;
- case VBO_ATTRIB_MAT_BACK_EMISSION:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_EMISSION, v ));
- break;
- case VBO_ATTRIB_MAT_FRONT_AMBIENT:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_AMBIENT, v ));
- break;
- case VBO_ATTRIB_MAT_BACK_AMBIENT:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_AMBIENT, v ));
- break;
- case VBO_ATTRIB_MAT_FRONT_DIFFUSE:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_DIFFUSE, v ));
- break;
- case VBO_ATTRIB_MAT_BACK_DIFFUSE:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_DIFFUSE, v ));
- break;
- case VBO_ATTRIB_MAT_FRONT_SPECULAR:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SPECULAR, v ));
- break;
- case VBO_ATTRIB_MAT_BACK_SPECULAR:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SPECULAR, v ));
- break;
- }
-}
-
-
-static attr_func mat_attrfunc[4] = {
- mat_attr1fv,
- NULL,
- mat_attr3fv,
- mat_attr4fv
-};
-
-
-static void index_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- (void) target;
- CALL_Indexf(ctx->Exec, (v[0]));
-}
-
-static void edgeflag_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- (void) target;
- CALL_EdgeFlag(ctx->Exec, ((GLboolean)(v[0] == 1.0)));
-}
-
struct loopback_attr {
GLint target;
GLint sz;
struct loopback_attr la[VBO_ATTRIB_MAX];
GLuint i, nr = 0;
- for (i = 0 ; i <= VBO_ATTRIB_TEX7 ; i++) {
+ /* All Legacy, NV, ARB and Material attributes are routed through
+ * the NV attributes entrypoints:
+ */
+ for (i = 0 ; i < VBO_ATTRIB_MAX ; i++) {
if (attrsz[i]) {
la[nr].target = i;
la[nr].sz = attrsz[i];
}
}
- for (i = VBO_ATTRIB_MAT_FRONT_AMBIENT ;
- i <= VBO_ATTRIB_MAT_BACK_INDEXES ;
- i++) {
- if (attrsz[i]) {
- la[nr].target = i;
- la[nr].sz = attrsz[i];
- la[nr].func = mat_attrfunc[attrsz[i]-1];
- nr++;
- }
- }
-
- if (attrsz[VBO_ATTRIB_EDGEFLAG]) {
- la[nr].target = VBO_ATTRIB_EDGEFLAG;
- la[nr].sz = attrsz[VBO_ATTRIB_EDGEFLAG];
- la[nr].func = edgeflag_attr1fv;
- nr++;
- }
-
- if (attrsz[VBO_ATTRIB_INDEX]) {
- la[nr].target = VBO_ATTRIB_INDEX;
- la[nr].sz = attrsz[VBO_ATTRIB_INDEX];
- la[nr].func = index_attr1fv;
- nr++;
- }
-
- /* XXX ARB vertex attribs */
-
for (i = 0 ; i < prim_count ; i++) {
if ((prim[i].mode & VBO_SAVE_PRIM_WEAK) &&
(ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END))