diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/api_arrayelt.c | 475 | ||||
-rw-r--r-- | src/mesa/main/dd.h | 3 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 40 | ||||
-rw-r--r-- | src/mesa/main/varray.c | 23 | ||||
-rw-r--r-- | src/mesa/main/vtxfmt.c | 23 |
5 files changed, 514 insertions, 50 deletions
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index e905f164025..9c65ae5b9a1 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.1 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * @@ -147,7 +147,10 @@ static const int NormalFuncs[8] = { static int SecondaryColorFuncs[8]; static int FogCoordFuncs[8]; -/**********************************************************************/ + +/** + ** GL_NV_vertex_program + **/ /* GL_BYTE attributes */ @@ -580,6 +583,442 @@ static attrib_func AttribFuncsNV[2][4][8] = { } }; + +/** + ** GL_ARB_vertex_program + **/ + +/* GL_BYTE attributes */ + +static void GLAPIENTRY VertexAttrib1NbvARB(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1bvARB(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NbvARB(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2bvARB(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NbvARB(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), + BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]))); +} + +static void GLAPIENTRY VertexAttrib3bvARB(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NbvARB(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), + BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]), + BYTE_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4bvARB(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_UNSIGNED_BYTE attributes */ + +static void GLAPIENTRY VertexAttrib1NubvARB(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1ubvARB(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NubvARB(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), + UBYTE_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2ubvARB(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NubvARB(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), + UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]))); +} +static void GLAPIENTRY VertexAttrib3ubvARB(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NubvARB(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), + UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), + UBYTE_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4ubvARB(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_SHORT attributes */ + +static void GLAPIENTRY VertexAttrib1NsvARB(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1svARB(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NsvARB(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), + SHORT_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2svARB(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NsvARB(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), + SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]))); +} + +static void GLAPIENTRY VertexAttrib3svARB(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NsvARB(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), + SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]), + SHORT_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4svARB(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_UNSIGNED_SHORT attributes */ + +static void GLAPIENTRY VertexAttrib1NusvARB(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1usvARB(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NusvARB(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), + USHORT_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2usvARB(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NusvARB(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), + USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]))); +} + +static void GLAPIENTRY VertexAttrib3usvARB(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NusvARB(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), + USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]), + USHORT_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4usvARB(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_INT attributes */ + +static void GLAPIENTRY VertexAttrib1NivARB(GLuint index, const GLint *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1ivARB(GLuint index, const GLint *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NivARB(GLuint index, const GLint *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), + INT_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2ivARB(GLuint index, const GLint *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NivARB(GLuint index, const GLint *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), + INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]))); +} + +static void GLAPIENTRY VertexAttrib3ivARB(GLuint index, const GLint *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NivARB(GLuint index, const GLint *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), + INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]), + INT_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4ivARB(GLuint index, const GLint *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_UNSIGNED_INT attributes */ + +static void GLAPIENTRY VertexAttrib1NuivARB(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1uivARB(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NuivARB(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), + UINT_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2uivARB(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NuivARB(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), + UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]))); +} + +static void GLAPIENTRY VertexAttrib3uivARB(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NuivARB(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), + UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]), + UINT_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4uivARB(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_FLOAT attributes */ + +static void GLAPIENTRY VertexAttrib1fvARB(GLuint index, const GLfloat *v) +{ + CALL_VertexAttrib1fvARB(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib2fvARB(GLuint index, const GLfloat *v) +{ + CALL_VertexAttrib2fvARB(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib3fvARB(GLuint index, const GLfloat *v) +{ + CALL_VertexAttrib3fvARB(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib4fvARB(GLuint index, const GLfloat *v) +{ + CALL_VertexAttrib4fvARB(GET_DISPATCH(), (index, v)); +} + +/* GL_DOUBLE attributes */ + +static void GLAPIENTRY VertexAttrib1dvARB(GLuint index, const GLdouble *v) +{ + CALL_VertexAttrib1dvARB(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib2dvARB(GLuint index, const GLdouble *v) +{ + CALL_VertexAttrib2dvARB(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib3dvARB(GLuint index, const GLdouble *v) +{ + CALL_VertexAttrib3dvARB(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib4dvARB(GLuint index, const GLdouble *v) +{ + CALL_VertexAttrib4dvARB(GET_DISPATCH(), (index, v)); +} + + +/* + * Array [size][type] of VertexAttrib functions + */ +static attrib_func AttribFuncsARB[2][4][8] = { + { + /* non-normalized */ + { + /* size 1 */ + (attrib_func) VertexAttrib1bvARB, + (attrib_func) VertexAttrib1ubvARB, + (attrib_func) VertexAttrib1svARB, + (attrib_func) VertexAttrib1usvARB, + (attrib_func) VertexAttrib1ivARB, + (attrib_func) VertexAttrib1uivARB, + (attrib_func) VertexAttrib1fvARB, + (attrib_func) VertexAttrib1dvARB + }, + { + /* size 2 */ + (attrib_func) VertexAttrib2bvARB, + (attrib_func) VertexAttrib2ubvARB, + (attrib_func) VertexAttrib2svARB, + (attrib_func) VertexAttrib2usvARB, + (attrib_func) VertexAttrib2ivARB, + (attrib_func) VertexAttrib2uivARB, + (attrib_func) VertexAttrib2fvARB, + (attrib_func) VertexAttrib2dvARB + }, + { + /* size 3 */ + (attrib_func) VertexAttrib3bvARB, + (attrib_func) VertexAttrib3ubvARB, + (attrib_func) VertexAttrib3svARB, + (attrib_func) VertexAttrib3usvARB, + (attrib_func) VertexAttrib3ivARB, + (attrib_func) VertexAttrib3uivARB, + (attrib_func) VertexAttrib3fvARB, + (attrib_func) VertexAttrib3dvARB + }, + { + /* size 4 */ + (attrib_func) VertexAttrib4bvARB, + (attrib_func) VertexAttrib4ubvARB, + (attrib_func) VertexAttrib4svARB, + (attrib_func) VertexAttrib4usvARB, + (attrib_func) VertexAttrib4ivARB, + (attrib_func) VertexAttrib4uivARB, + (attrib_func) VertexAttrib4fvARB, + (attrib_func) VertexAttrib4dvARB + } + }, + { + /* normalized (except for float/double) */ + { + /* size 1 */ + (attrib_func) VertexAttrib1NbvARB, + (attrib_func) VertexAttrib1NubvARB, + (attrib_func) VertexAttrib1NsvARB, + (attrib_func) VertexAttrib1NusvARB, + (attrib_func) VertexAttrib1NivARB, + (attrib_func) VertexAttrib1NuivARB, + (attrib_func) VertexAttrib1fvARB, + (attrib_func) VertexAttrib1dvARB + }, + { + /* size 2 */ + (attrib_func) VertexAttrib2NbvARB, + (attrib_func) VertexAttrib2NubvARB, + (attrib_func) VertexAttrib2NsvARB, + (attrib_func) VertexAttrib2NusvARB, + (attrib_func) VertexAttrib2NivARB, + (attrib_func) VertexAttrib2NuivARB, + (attrib_func) VertexAttrib2fvARB, + (attrib_func) VertexAttrib2dvARB + }, + { + /* size 3 */ + (attrib_func) VertexAttrib3NbvARB, + (attrib_func) VertexAttrib3NubvARB, + (attrib_func) VertexAttrib3NsvARB, + (attrib_func) VertexAttrib3NusvARB, + (attrib_func) VertexAttrib3NivARB, + (attrib_func) VertexAttrib3NuivARB, + (attrib_func) VertexAttrib3fvARB, + (attrib_func) VertexAttrib3dvARB + }, + { + /* size 4 */ + (attrib_func) VertexAttrib4NbvARB, + (attrib_func) VertexAttrib4NubvARB, + (attrib_func) VertexAttrib4NsvARB, + (attrib_func) VertexAttrib4NusvARB, + (attrib_func) VertexAttrib4NivARB, + (attrib_func) VertexAttrib4NuivARB, + (attrib_func) VertexAttrib4fvARB, + (attrib_func) VertexAttrib4dvARB + } + } +}; + /**********************************************************************/ @@ -670,14 +1109,16 @@ static void _ae_update_state( GLcontext *ctx ) aa++; } for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { - if (ctx->Array.TexCoord[i].Enabled) { - /* NOTE: we use generic glVertexAttrib functions here. - * If we ever de-alias conventional/generic vertex attribs this - * will have to change. + struct gl_client_array *attribArray = &ctx->Array.TexCoord[i]; + if (attribArray->Enabled) { + /* NOTE: we use generic glVertexAttribNV functions here. + * If we ever remove GL_NV_vertex_program this will have to change. */ - struct gl_client_array *attribArray = &ctx->Array.TexCoord[i]; at->array = attribArray; - at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)]; + ASSERT(!at->array->Normalized); + at->func = AttribFuncsNV[at->array->Normalized] + [at->array->Size-1] + [TYPE_IDX(at->array->Type)]; at->index = VERT_ATTRIB_TEX0 + i; at++; } @@ -685,15 +1126,25 @@ static void _ae_update_state( GLcontext *ctx ) /* generic vertex attribute arrays */ for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */ - if (ctx->Array.VertexAttrib[i].Enabled) { - struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[i]; + struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[i]; + if (attribArray->Enabled) { at->array = attribArray; /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV * function pointer here (for float arrays) since the pointer may * change from one execution of _ae_loopback_array_elt() to * the next. Doing so caused UT to break. */ - at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)]; + if (ctx->VertexProgram._Enabled + && ctx->VertexProgram.Current->IsNVProgram) { + at->func = AttribFuncsNV[at->array->Normalized] + [at->array->Size-1] + [TYPE_IDX(at->array->Type)]; + } + else { + at->func = AttribFuncsARB[at->array->Normalized] + [at->array->Size-1] + [TYPE_IDX(at->array->Type)]; + } at->index = i; at++; } @@ -702,7 +1153,7 @@ static void _ae_update_state( GLcontext *ctx ) /* finally, vertex position */ if (ctx->Array.VertexAttrib[0].Enabled) { /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's - * issued as the last (proviking) attribute). + * issued as the last (provoking) attribute). */ aa->array = &ctx->Array.VertexAttrib[0]; assert(aa->array->Size >= 2); /* XXX fix someday? */ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 4f1a962731d..b1c78f2232c 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1017,6 +1017,7 @@ typedef struct { void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); /* NOTE */ void (GLAPIENTRYP Begin)( GLenum ); void (GLAPIENTRYP End)( void ); + /* GL_NV_vertex_program */ void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x ); void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y ); @@ -1025,6 +1026,7 @@ typedef struct { void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); +#if FEATURE_ARB_vertex_program void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x ); void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y ); @@ -1033,6 +1035,7 @@ typedef struct { void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v ); +#endif /*@}*/ /* diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a78a7d1927f..244d1c64f86 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -613,29 +613,27 @@ struct gl_colorbuffer_attrib struct gl_current_attrib { /** - * \name Values valid only when FLUSH_VERTICES has been called. + * \name Current vertex attributes. + * \note Values are valid only after FLUSH_VERTICES has been called. */ /*@{*/ - GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Current vertex attributes - * indexed by VERT_ATTRIB_* */ - GLfloat Index; /**< Current color index */ - GLboolean EdgeFlag; /**< Current edge flag */ + GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Position, color, texcoords, etc */ + GLfloat Index; /**< Current color index */ + GLboolean EdgeFlag; /**< Current edge flag */ /*@}*/ /** - * \name Values are always valid. - * - * \note BTW, note how similar this set of attributes is to the SWvertex - * data type in the software rasterizer... + * \name Current raster position attributes (always valid). + * \note This set of attributes is very similar to the SWvertex struct. */ /*@{*/ - GLfloat RasterPos[4]; /**< Current raster position */ - GLfloat RasterDistance; /**< Current raster distance */ - GLfloat RasterColor[4]; /**< Current raster color */ - GLfloat RasterSecondaryColor[4]; /**< Current raster secondary color */ - GLfloat RasterIndex; /**< Current raster index */ + GLfloat RasterPos[4]; + GLfloat RasterDistance; + GLfloat RasterColor[4]; + GLfloat RasterSecondaryColor[4]; + GLfloat RasterIndex; GLfloat RasterTexCoords[MAX_TEXTURE_COORD_UNITS][4]; - GLboolean RasterPosValid; /**< Raster pos valid flag */ + GLboolean RasterPosValid; /*@}*/ }; @@ -1641,7 +1639,9 @@ struct gl_client_array */ struct gl_array_attrib { - struct gl_client_array Vertex; /**< client data descriptors */ + /** Conventional vertex arrays */ + /*@{*/ + struct gl_client_array Vertex; struct gl_client_array Normal; struct gl_client_array Color; struct gl_client_array SecondaryColor; @@ -1649,15 +1649,17 @@ struct gl_array_attrib struct gl_client_array Index; struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS]; struct gl_client_array EdgeFlag; + /*@}*/ - struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX]; /**< GL_NV_vertex_program */ + /** Generic arrays for vertex programs/shaders; */ + struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX]; GLint ActiveTexture; /**< Client Active Texture */ GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */ GLuint LockCount; /**< GL_EXT_compiled_vertex_array */ - GLbitfield _Enabled; /**< _NEW_ARRAY_* - bit set if array enabled */ - GLbitfield NewState; /**< _NEW_ARRAY_* */ + GLbitfield _Enabled; /**< mask of _NEW_ARRAY_* values */ + GLbitfield NewState; /**< mask of _NEW_ARRAY_* values */ #if FEATURE_ARB_vertex_buffer_object struct gl_buffer_object *NullBufferObj; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 87d9660b7ed..97b02142936 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.1 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * @@ -29,8 +29,6 @@ #include "context.h" #include "enable.h" #include "enums.h" -#include "dlist.h" -#include "texstate.h" #include "mtypes.h" #include "varray.h" #include "dispatch.h" @@ -47,7 +45,7 @@ */ static void update_array(GLcontext *ctx, struct gl_client_array *array, - GLuint dirtyFlag, GLsizei elementSize, + GLbitfield dirtyFlag, GLsizei elementSize, GLint size, GLenum type, GLsizei stride, GLboolean normalized, const GLvoid *ptr) { @@ -437,6 +435,7 @@ void GLAPIENTRY _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { + const GLboolean normalized = GL_FALSE; GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -481,7 +480,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, } update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), - elementSize, size, type, stride, GL_FALSE, ptr); + elementSize, size, type, stride, normalized, ptr); if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); @@ -754,6 +753,7 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) _mesa_DisableClientState( GL_EDGE_FLAG_ARRAY ); _mesa_DisableClientState( GL_INDEX_ARRAY ); + /* XXX also disable secondary color and generic arrays? */ /* Texcoords */ if (tflag) { @@ -917,12 +917,11 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, } -/**********************************************************************/ -/***** Initialization *****/ -/**********************************************************************/ - +/** + * Initialize vertex array state for given context. + */ void -_mesa_init_varray( GLcontext * ctx ) +_mesa_init_varray(GLcontext *ctx) { GLuint i; @@ -981,7 +980,6 @@ _mesa_init_varray( GLcontext * ctx ) ctx->Array.EdgeFlag.Ptr = NULL; ctx->Array.EdgeFlag.Enabled = GL_FALSE; ctx->Array.EdgeFlag.Flags = CA_CLIENT_DATA; - ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ for (i = 0; i < VERT_ATTRIB_MAX; i++) { ctx->Array.VertexAttrib[i].Size = 4; ctx->Array.VertexAttrib[i].Type = GL_FLOAT; @@ -989,6 +987,9 @@ _mesa_init_varray( GLcontext * ctx ) ctx->Array.VertexAttrib[i].StrideB = 0; ctx->Array.VertexAttrib[i].Ptr = NULL; ctx->Array.VertexAttrib[i].Enabled = GL_FALSE; + ctx->Array.VertexAttrib[i].Normalized = GL_FALSE; ctx->Array.VertexAttrib[i].Flags = CA_CLIENT_DATA; } + + ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ } diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index b3c63982911..99583a20da5 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -72,7 +72,10 @@ #include "vtxfmt_tmp.h" - +/** + * Use the per-vertex functions found in <vfmt> to initialze the given + * API dispatch table. + */ static void install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) { @@ -124,6 +127,15 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_CallLists(tab, vfmt->CallLists); SET_Begin(tab, vfmt->Begin); SET_End(tab, vfmt->End); + SET_Rectf(tab, vfmt->Rectf); + SET_DrawArrays(tab, vfmt->DrawArrays); + SET_DrawElements(tab, vfmt->DrawElements); + SET_DrawRangeElements(tab, vfmt->DrawRangeElements); + SET_EvalMesh1(tab, vfmt->EvalMesh1); + SET_EvalMesh2(tab, vfmt->EvalMesh2); + ASSERT(tab->EvalMesh2); + + /* GL_NV_vertex_program */ SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV); SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV); SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV); @@ -132,6 +144,7 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_VertexAttrib3fvNV(tab, vfmt->VertexAttrib3fvNV); SET_VertexAttrib4fNV(tab, vfmt->VertexAttrib4fNV); SET_VertexAttrib4fvNV(tab, vfmt->VertexAttrib4fvNV); +#if FEATURE_ARB_vertex_program SET_VertexAttrib1fARB(tab, vfmt->VertexAttrib1fARB); SET_VertexAttrib1fvARB(tab, vfmt->VertexAttrib1fvARB); SET_VertexAttrib2fARB(tab, vfmt->VertexAttrib2fARB); @@ -140,13 +153,7 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_VertexAttrib3fvARB(tab, vfmt->VertexAttrib3fvARB); SET_VertexAttrib4fARB(tab, vfmt->VertexAttrib4fARB); SET_VertexAttrib4fvARB(tab, vfmt->VertexAttrib4fvARB); - SET_Rectf(tab, vfmt->Rectf); - SET_DrawArrays(tab, vfmt->DrawArrays); - SET_DrawElements(tab, vfmt->DrawElements); - SET_DrawRangeElements(tab, vfmt->DrawRangeElements); - SET_EvalMesh1(tab, vfmt->EvalMesh1); - SET_EvalMesh2(tab, vfmt->EvalMesh2); - ASSERT(tab->EvalMesh2); +#endif } |