diff options
author | Keith Whitwell <[email protected]> | 2007-01-15 13:40:38 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2007-01-15 13:40:38 +0000 |
commit | 2421b25dd777ebfd614ae45907fd4af8c2713102 (patch) | |
tree | 652a05de41f0df5beea7924506e318788d0ab3fe /src/mesa/vbo | |
parent | 1b7c24c33c43e2c0db391735b2f2ca0026459cc9 (diff) |
Remove special-case handling for index and edgeflag
This isn't required with the changes to core mesa and the new
attribute layout.
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo_attrib_tmp.h | 5 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 6 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save.h | 2 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_api.c | 44 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_loopback.c | 148 |
5 files changed, 24 insertions, 181 deletions
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h index 72a8b04aca1..ff11c7d59a7 100644 --- a/src/mesa/vbo/vbo_attrib_tmp.h +++ b/src/mesa/vbo/vbo_attrib_tmp.h @@ -357,9 +357,10 @@ static void GLAPIENTRY TAG(VertexAttrib4fvARB)( GLuint index, } -/* Although we don't export NV_vertex_program, these entrypoints are +/* In addition to supporting NV_vertex_program, these entrypoints are * used by the display list and other code specifically because of - * their property of aliasing with other attributes. + * their property of aliasing with other attributes. (See + * vbo_save_loopback.c) */ static void GLAPIENTRY TAG(VertexAttrib1fNV)( GLuint index, GLfloat x ) { diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 803e58c1485..15fbdcf8a56 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -96,10 +96,10 @@ static void bind_array_obj( GLcontext *ctx ) exec->array.legacy_array[VERT_ATTRIB_COLOR1] = &ctx->Array.ArrayObj->SecondaryColor; exec->array.legacy_array[VERT_ATTRIB_FOG] = &ctx->Array.ArrayObj->FogCoord; exec->array.legacy_array[VERT_ATTRIB_COLOR_INDEX] = &ctx->Array.ArrayObj->Index; - exec->array.legacy_array[VBO_ATTRIB_EDGEFLAG] = &ctx->Array.ArrayObj->EdgeFlag; + exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &ctx->Array.ArrayObj->EdgeFlag; for (i = 0; i < 8; i++) - exec->array.legacy_array[VBO_ATTRIB_TEX0 + i] = &ctx->Array.ArrayObj->TexCoord[i]; + exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &ctx->Array.ArrayObj->TexCoord[i]; for (i = 0; i < VERT_ATTRIB_MAX; i++) exec->array.generic_array[i] = &ctx->Array.ArrayObj->VertexAttrib[i]; @@ -117,8 +117,6 @@ static void recalculate_input_bindings( GLcontext *ctx ) exec->array.program_mode = get_program_mode(ctx); exec->array.enabled_flags = ctx->Array.ArrayObj->_Enabled; - /* TODO: Get rid of NV_program (please!). - */ switch (exec->array.program_mode) { case VP_NONE: /* When no vertex program is active, we put the material values diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index 3051f5c59a1..b81f275a602 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -142,8 +142,6 @@ struct vbo_save_context { struct vbo_save_copied_vtx copied; - GLfloat CurrentFloatEdgeFlag; - GLfloat *current[VBO_ATTRIB_MAX]; /* points into ctx->ListState */ GLubyte *currentsz[VBO_ATTRIB_MAX]; }; diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index efe018b09e2..f339436f84c 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -415,26 +415,14 @@ static void _save_copy_to_current( GLcontext *ctx ) 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); - } } @@ -443,7 +431,7 @@ static void _save_copy_from_current( GLcontext *ctx ) 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]; @@ -451,12 +439,6 @@ static void _save_copy_from_current( GLcontext *ctx ) 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; } } @@ -616,6 +598,8 @@ do { \ 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; \ @@ -1106,23 +1090,19 @@ static void _save_current_init( GLcontext *ctx ) 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; } /** diff --git a/src/mesa/vbo/vbo_save_loopback.c b/src/mesa/vbo/vbo_save_loopback.c index 941c4beea94..2c28126cab2 100644 --- a/src/mesa/vbo/vbo_save_loopback.c +++ b/src/mesa/vbo/vbo_save_loopback.c @@ -44,7 +44,9 @@ 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)); @@ -72,118 +74,6 @@ static attr_func vert_attrfunc[4] = { 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; @@ -277,7 +167,10 @@ void vbo_loopback_vertex_list( GLcontext *ctx, 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]; @@ -286,33 +179,6 @@ void vbo_loopback_vertex_list( GLcontext *ctx, } } - 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)) |