diff options
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo_attrib_tmp.h | 616 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_api.c | 18 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_api.c | 18 |
3 files changed, 471 insertions, 181 deletions
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h index 7a889b8e2f8..3c235accf30 100644 --- a/src/mesa/vbo/vbo_attrib_tmp.h +++ b/src/mesa/vbo/vbo_attrib_tmp.h @@ -25,6 +25,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ +/* float */ #define ATTR1FV( A, V ) ATTR( A, 1, (V)[0], 0, 0, 1 ) #define ATTR2FV( A, V ) ATTR( A, 2, (V)[0], (V)[1], 0, 1 ) #define ATTR3FV( A, V ) ATTR( A, 3, (V)[0], (V)[1], (V)[2], 1 ) @@ -35,235 +36,307 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define ATTR3F( A, X, Y, Z ) ATTR( A, 3, X, Y, Z, 1 ) #define ATTR4F( A, X, Y, Z, W ) ATTR( A, 4, X, Y, Z, W ) +/* int */ +#define ATTR2IV( A, V ) ATTR( A, 2, (V)[0], (V)[1], 0, 1 ) +#define ATTR3IV( A, V ) ATTR( A, 3, (V)[0], (V)[1], (V)[2], 1 ) +#define ATTR4IV( A, V ) ATTR( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] ) + +#define ATTR1I( A, X ) ATTR( A, 1, X, 0, 0, 1 ) +#define ATTR2I( A, X, Y ) ATTR( A, 2, X, Y, 0, 1 ) +#define ATTR3I( A, X, Y, Z ) ATTR( A, 3, X, Y, Z, 1 ) +#define ATTR4I( A, X, Y, Z, W ) ATTR( A, 4, X, Y, Z, W ) + + +/* uint */ +#define ATTR2UIV( A, V ) ATTR( A, 2, (V)[0], (V)[1], 0, 1 ) +#define ATTR3UIV( A, V ) ATTR( A, 3, (V)[0], (V)[1], (V)[2], 1 ) +#define ATTR4UIV( A, V ) ATTR( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] ) + +#define ATTR1UI( A, X ) ATTR( A, 1, X, 0, 0, 1 ) +#define ATTR2UI( A, X, Y ) ATTR( A, 2, X, Y, 0, 1 ) +#define ATTR3UI( A, X, Y, Z ) ATTR( A, 3, X, Y, Z, 1 ) +#define ATTR4UI( A, X, Y, Z, W ) ATTR( A, 4, X, Y, Z, W ) + #define MAT_ATTR( A, N, V ) ATTR( A, N, (V)[0], (V)[1], (V)[2], (V)[3] ) -static void GLAPIENTRY TAG(Vertex2f)( GLfloat x, GLfloat y ) + + +static void GLAPIENTRY +TAG(Vertex2f)(GLfloat x, GLfloat y) { - GET_CURRENT_CONTEXT( ctx ); - ATTR2F( VBO_ATTRIB_POS, x, y ); + GET_CURRENT_CONTEXT(ctx); + ATTR2F(VBO_ATTRIB_POS, x, y); } -static void GLAPIENTRY TAG(Vertex2fv)( const GLfloat *v ) +static void GLAPIENTRY +TAG(Vertex2fv)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR2FV( VBO_ATTRIB_POS, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR2FV(VBO_ATTRIB_POS, v); } -static void GLAPIENTRY TAG(Vertex3f)( GLfloat x, GLfloat y, GLfloat z ) +static void GLAPIENTRY +TAG(Vertex3f)(GLfloat x, GLfloat y, GLfloat z) { - GET_CURRENT_CONTEXT( ctx ); - ATTR3F( VBO_ATTRIB_POS, x, y, z ); + GET_CURRENT_CONTEXT(ctx); + ATTR3F(VBO_ATTRIB_POS, x, y, z); } -static void GLAPIENTRY TAG(Vertex3fv)( const GLfloat *v ) +static void GLAPIENTRY +TAG(Vertex3fv)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR3FV( VBO_ATTRIB_POS, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR3FV(VBO_ATTRIB_POS, v); } -static void GLAPIENTRY TAG(Vertex4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +static void GLAPIENTRY +TAG(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - GET_CURRENT_CONTEXT( ctx ); - ATTR4F( VBO_ATTRIB_POS, x, y, z, w ); + GET_CURRENT_CONTEXT(ctx); + ATTR4F(VBO_ATTRIB_POS, x, y, z, w); } -static void GLAPIENTRY TAG(Vertex4fv)( const GLfloat *v ) +static void GLAPIENTRY +TAG(Vertex4fv)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR4FV( VBO_ATTRIB_POS, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR4FV(VBO_ATTRIB_POS, v); } -static void GLAPIENTRY TAG(TexCoord1f)( GLfloat x ) + + +static void GLAPIENTRY +TAG(TexCoord1f)(GLfloat x) { - GET_CURRENT_CONTEXT( ctx ); - ATTR1F( VBO_ATTRIB_TEX0, x ); + GET_CURRENT_CONTEXT(ctx); + ATTR1F(VBO_ATTRIB_TEX0, x); } -static void GLAPIENTRY TAG(TexCoord1fv)( const GLfloat *v ) +static void GLAPIENTRY +TAG(TexCoord1fv)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR1FV( VBO_ATTRIB_TEX0, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR1FV(VBO_ATTRIB_TEX0, v); } -static void GLAPIENTRY TAG(TexCoord2f)( GLfloat x, GLfloat y ) +static void GLAPIENTRY +TAG(TexCoord2f)(GLfloat x, GLfloat y) { - GET_CURRENT_CONTEXT( ctx ); - ATTR2F( VBO_ATTRIB_TEX0, x, y ); + GET_CURRENT_CONTEXT(ctx); + ATTR2F(VBO_ATTRIB_TEX0, x, y); } -static void GLAPIENTRY TAG(TexCoord2fv)( const GLfloat *v ) +static void GLAPIENTRY +TAG(TexCoord2fv)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR2FV( VBO_ATTRIB_TEX0, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR2FV(VBO_ATTRIB_TEX0, v); } -static void GLAPIENTRY TAG(TexCoord3f)( GLfloat x, GLfloat y, GLfloat z ) +static void GLAPIENTRY +TAG(TexCoord3f)(GLfloat x, GLfloat y, GLfloat z) { - GET_CURRENT_CONTEXT( ctx ); - ATTR3F( VBO_ATTRIB_TEX0, x, y, z ); + GET_CURRENT_CONTEXT(ctx); + ATTR3F(VBO_ATTRIB_TEX0, x, y, z); } -static void GLAPIENTRY TAG(TexCoord3fv)( const GLfloat *v ) +static void GLAPIENTRY +TAG(TexCoord3fv)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR3FV( VBO_ATTRIB_TEX0, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR3FV(VBO_ATTRIB_TEX0, v); } -static void GLAPIENTRY TAG(TexCoord4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +static void GLAPIENTRY +TAG(TexCoord4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - GET_CURRENT_CONTEXT( ctx ); - ATTR4F( VBO_ATTRIB_TEX0, x, y, z, w ); + GET_CURRENT_CONTEXT(ctx); + ATTR4F(VBO_ATTRIB_TEX0, x, y, z, w); } -static void GLAPIENTRY TAG(TexCoord4fv)( const GLfloat *v ) +static void GLAPIENTRY +TAG(TexCoord4fv)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR4FV( VBO_ATTRIB_TEX0, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR4FV(VBO_ATTRIB_TEX0, v); } -static void GLAPIENTRY TAG(Normal3f)( GLfloat x, GLfloat y, GLfloat z ) + + +static void GLAPIENTRY +TAG(Normal3f)(GLfloat x, GLfloat y, GLfloat z) { - GET_CURRENT_CONTEXT( ctx ); - ATTR3F( VBO_ATTRIB_NORMAL, x, y, z ); + GET_CURRENT_CONTEXT(ctx); + ATTR3F(VBO_ATTRIB_NORMAL, x, y, z); } -static void GLAPIENTRY TAG(Normal3fv)( const GLfloat *v ) +static void GLAPIENTRY +TAG(Normal3fv)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR3FV( VBO_ATTRIB_NORMAL, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR3FV(VBO_ATTRIB_NORMAL, v); } -static void GLAPIENTRY TAG(FogCoordfEXT)( GLfloat x ) + + +static void GLAPIENTRY +TAG(FogCoordfEXT)(GLfloat x) { - GET_CURRENT_CONTEXT( ctx ); - ATTR1F( VBO_ATTRIB_FOG, x ); + GET_CURRENT_CONTEXT(ctx); + ATTR1F(VBO_ATTRIB_FOG, x); } -static void GLAPIENTRY TAG(FogCoordfvEXT)( const GLfloat *v ) + + +static void GLAPIENTRY +TAG(FogCoordfvEXT)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR1FV( VBO_ATTRIB_FOG, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR1FV(VBO_ATTRIB_FOG, v); } -static void GLAPIENTRY TAG(Color3f)( GLfloat x, GLfloat y, GLfloat z ) +static void GLAPIENTRY +TAG(Color3f)(GLfloat x, GLfloat y, GLfloat z) { - GET_CURRENT_CONTEXT( ctx ); - ATTR3F( VBO_ATTRIB_COLOR0, x, y, z ); + GET_CURRENT_CONTEXT(ctx); + ATTR3F(VBO_ATTRIB_COLOR0, x, y, z); } -static void GLAPIENTRY TAG(Color3fv)( const GLfloat *v ) +static void GLAPIENTRY +TAG(Color3fv)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR3FV( VBO_ATTRIB_COLOR0, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR3FV(VBO_ATTRIB_COLOR0, v); } -static void GLAPIENTRY TAG(Color4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +static void GLAPIENTRY +TAG(Color4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - GET_CURRENT_CONTEXT( ctx ); - ATTR4F( VBO_ATTRIB_COLOR0, x, y, z, w ); + GET_CURRENT_CONTEXT(ctx); + ATTR4F(VBO_ATTRIB_COLOR0, x, y, z, w); } -static void GLAPIENTRY TAG(Color4fv)( const GLfloat *v ) +static void GLAPIENTRY +TAG(Color4fv)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR4FV( VBO_ATTRIB_COLOR0, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR4FV(VBO_ATTRIB_COLOR0, v); } -static void GLAPIENTRY TAG(SecondaryColor3fEXT)( GLfloat x, GLfloat y, GLfloat z ) + + +static void GLAPIENTRY +TAG(SecondaryColor3fEXT)(GLfloat x, GLfloat y, GLfloat z) { - GET_CURRENT_CONTEXT( ctx ); - ATTR3F( VBO_ATTRIB_COLOR1, x, y, z ); + GET_CURRENT_CONTEXT(ctx); + ATTR3F(VBO_ATTRIB_COLOR1, x, y, z); } -static void GLAPIENTRY TAG(SecondaryColor3fvEXT)( const GLfloat *v ) +static void GLAPIENTRY +TAG(SecondaryColor3fvEXT)(const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - ATTR3FV( VBO_ATTRIB_COLOR1, v ); + GET_CURRENT_CONTEXT(ctx); + ATTR3FV(VBO_ATTRIB_COLOR1, v); } -static void GLAPIENTRY TAG(EdgeFlag)( GLboolean b ) + +static void GLAPIENTRY +TAG(EdgeFlag)(GLboolean b) { - GET_CURRENT_CONTEXT( ctx ); - ATTR1F( VBO_ATTRIB_EDGEFLAG, (GLfloat)b ); + GET_CURRENT_CONTEXT(ctx); + ATTR1F(VBO_ATTRIB_EDGEFLAG, (GLfloat) b); } -static void GLAPIENTRY TAG(Indexf)( GLfloat f ) + + +static void GLAPIENTRY +TAG(Indexf)(GLfloat f) { - GET_CURRENT_CONTEXT( ctx ); - ATTR1F( VBO_ATTRIB_INDEX, f ); + GET_CURRENT_CONTEXT(ctx); + ATTR1F(VBO_ATTRIB_INDEX, f); } -static void GLAPIENTRY TAG(Indexfv)( const GLfloat *f ) +static void GLAPIENTRY +TAG(Indexfv)(const GLfloat * f) { - GET_CURRENT_CONTEXT( ctx ); - ATTR1FV( VBO_ATTRIB_INDEX, f ); + GET_CURRENT_CONTEXT(ctx); + ATTR1FV(VBO_ATTRIB_INDEX, f); } -static void GLAPIENTRY TAG(MultiTexCoord1f)( GLenum target, GLfloat x ) + +static void GLAPIENTRY +TAG(MultiTexCoord1f)(GLenum target, GLfloat x) { - GET_CURRENT_CONTEXT( ctx ); + GET_CURRENT_CONTEXT(ctx); GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0; - ATTR1F( attr, x ); + ATTR1F(attr, x); } -static void GLAPIENTRY TAG(MultiTexCoord1fv)( GLenum target, const GLfloat *v ) +static void GLAPIENTRY +TAG(MultiTexCoord1fv)(GLenum target, const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); + GET_CURRENT_CONTEXT(ctx); GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0; - ATTR1FV( attr, v ); + ATTR1FV(attr, v); } -static void GLAPIENTRY TAG(MultiTexCoord2f)( GLenum target, GLfloat x, GLfloat y ) +static void GLAPIENTRY +TAG(MultiTexCoord2f)(GLenum target, GLfloat x, GLfloat y) { - GET_CURRENT_CONTEXT( ctx ); + GET_CURRENT_CONTEXT(ctx); GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0; - ATTR2F( attr, x, y ); + ATTR2F(attr, x, y); } -static void GLAPIENTRY TAG(MultiTexCoord2fv)( GLenum target, const GLfloat *v ) +static void GLAPIENTRY +TAG(MultiTexCoord2fv)(GLenum target, const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); + GET_CURRENT_CONTEXT(ctx); GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0; - ATTR2FV( attr, v ); + ATTR2FV(attr, v); } -static void GLAPIENTRY TAG(MultiTexCoord3f)( GLenum target, GLfloat x, GLfloat y, - GLfloat z) +static void GLAPIENTRY +TAG(MultiTexCoord3f)(GLenum target, GLfloat x, GLfloat y, GLfloat z) { - GET_CURRENT_CONTEXT( ctx ); + GET_CURRENT_CONTEXT(ctx); GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0; - ATTR3F( attr, x, y, z ); + ATTR3F(attr, x, y, z); } -static void GLAPIENTRY TAG(MultiTexCoord3fv)( GLenum target, const GLfloat *v ) +static void GLAPIENTRY +TAG(MultiTexCoord3fv)(GLenum target, const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); + GET_CURRENT_CONTEXT(ctx); GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0; - ATTR3FV( attr, v ); + ATTR3FV(attr, v); } -static void GLAPIENTRY TAG(MultiTexCoord4f)( GLenum target, GLfloat x, GLfloat y, - GLfloat z, GLfloat w ) +static void GLAPIENTRY +TAG(MultiTexCoord4f)(GLenum target, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - GET_CURRENT_CONTEXT( ctx ); + GET_CURRENT_CONTEXT(ctx); GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0; - ATTR4F( attr, x, y, z, w ); + ATTR4F(attr, x, y, z, w); } -static void GLAPIENTRY TAG(MultiTexCoord4fv)( GLenum target, const GLfloat *v ) +static void GLAPIENTRY +TAG(MultiTexCoord4fv)(GLenum target, const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); + GET_CURRENT_CONTEXT(ctx); GLuint attr = (target & 0x7) + VBO_ATTRIB_TEX0; - ATTR4FV( attr, v ); + ATTR4FV(attr, v); } -static void GLAPIENTRY TAG(VertexAttrib1fARB)( GLuint index, GLfloat x ) + +static void GLAPIENTRY +TAG(VertexAttrib1fARB)(GLuint index, GLfloat x) { - GET_CURRENT_CONTEXT( ctx ); - if (index == 0) + GET_CURRENT_CONTEXT(ctx); + if (index == 0) ATTR1F(0, x); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR1F(VBO_ATTRIB_GENERIC0 + index, x); @@ -271,11 +344,11 @@ static void GLAPIENTRY TAG(VertexAttrib1fARB)( GLuint index, GLfloat x ) ERROR(); } -static void GLAPIENTRY TAG(VertexAttrib1fvARB)( GLuint index, - const GLfloat *v ) +static void GLAPIENTRY +TAG(VertexAttrib1fvARB)(GLuint index, const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - if (index == 0) + GET_CURRENT_CONTEXT(ctx); + if (index == 0) ATTR1FV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR1FV(VBO_ATTRIB_GENERIC0 + index, v); @@ -283,11 +356,11 @@ static void GLAPIENTRY TAG(VertexAttrib1fvARB)( GLuint index, ERROR(); } -static void GLAPIENTRY TAG(VertexAttrib2fARB)( GLuint index, GLfloat x, - GLfloat y ) +static void GLAPIENTRY +TAG(VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y) { - GET_CURRENT_CONTEXT( ctx ); - if (index == 0) + GET_CURRENT_CONTEXT(ctx); + if (index == 0) ATTR2F(0, x, y); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR2F(VBO_ATTRIB_GENERIC0 + index, x, y); @@ -295,11 +368,11 @@ static void GLAPIENTRY TAG(VertexAttrib2fARB)( GLuint index, GLfloat x, ERROR(); } -static void GLAPIENTRY TAG(VertexAttrib2fvARB)( GLuint index, - const GLfloat *v ) +static void GLAPIENTRY +TAG(VertexAttrib2fvARB)(GLuint index, const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - if (index == 0) + GET_CURRENT_CONTEXT(ctx); + if (index == 0) ATTR2FV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR2FV(VBO_ATTRIB_GENERIC0 + index, v); @@ -307,11 +380,11 @@ static void GLAPIENTRY TAG(VertexAttrib2fvARB)( GLuint index, ERROR(); } -static void GLAPIENTRY TAG(VertexAttrib3fARB)( GLuint index, GLfloat x, - GLfloat y, GLfloat z ) +static void GLAPIENTRY +TAG(VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z) { - GET_CURRENT_CONTEXT( ctx ); - if (index == 0) + GET_CURRENT_CONTEXT(ctx); + if (index == 0) ATTR3F(0, x, y, z); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR3F(VBO_ATTRIB_GENERIC0 + index, x, y, z); @@ -319,11 +392,11 @@ static void GLAPIENTRY TAG(VertexAttrib3fARB)( GLuint index, GLfloat x, ERROR(); } -static void GLAPIENTRY TAG(VertexAttrib3fvARB)( GLuint index, - const GLfloat *v ) +static void GLAPIENTRY +TAG(VertexAttrib3fvARB)(GLuint index, const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - if (index == 0) + GET_CURRENT_CONTEXT(ctx); + if (index == 0) ATTR3FV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR3FV(VBO_ATTRIB_GENERIC0 + index, v); @@ -331,12 +404,11 @@ static void GLAPIENTRY TAG(VertexAttrib3fvARB)( GLuint index, ERROR(); } -static void GLAPIENTRY TAG(VertexAttrib4fARB)( GLuint index, GLfloat x, - GLfloat y, GLfloat z, - GLfloat w ) +static void GLAPIENTRY +TAG(VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - GET_CURRENT_CONTEXT( ctx ); - if (index == 0) + GET_CURRENT_CONTEXT(ctx); + if (index == 0) ATTR4F(0, x, y, z, w); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR4F(VBO_ATTRIB_GENERIC0 + index, x, y, z, w); @@ -344,11 +416,11 @@ static void GLAPIENTRY TAG(VertexAttrib4fARB)( GLuint index, GLfloat x, ERROR(); } -static void GLAPIENTRY TAG(VertexAttrib4fvARB)( GLuint index, - const GLfloat *v ) +static void GLAPIENTRY +TAG(VertexAttrib4fvARB)(GLuint index, const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - if (index == 0) + GET_CURRENT_CONTEXT(ctx); + if (index == 0) ATTR4FV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR4FV(VBO_ATTRIB_GENERIC0 + index, v); @@ -357,76 +429,257 @@ static void GLAPIENTRY TAG(VertexAttrib4fvARB)( GLuint index, } + +/* Integer-valued generic attributes. + * XXX: the integers just get converted to floats at this time + */ +static void GLAPIENTRY +TAG(VertexAttribI1i)(GLuint index, GLint x) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR1I(0, x); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR1I(VBO_ATTRIB_GENERIC0 + index, x); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI2i)(GLuint index, GLint x, GLint y) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR2I(0, x, y); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR2I(VBO_ATTRIB_GENERIC0 + index, x, y); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI3i)(GLuint index, GLint x, GLint y, GLint z) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR3I(0, x, y, z); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR3I(VBO_ATTRIB_GENERIC0 + index, x, y, z); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR4I(0, x, y, z, w); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR4I(VBO_ATTRIB_GENERIC0 + index, x, y, z, w); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI2iv)(GLuint index, const GLint *v) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR2IV(0, v); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR2IV(VBO_ATTRIB_GENERIC0 + index, v); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI3iv)(GLuint index, const GLint *v) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR3IV(0, v); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR3IV(VBO_ATTRIB_GENERIC0 + index, v); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI4iv)(GLuint index, const GLint *v) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR4IV(0, v); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR4IV(VBO_ATTRIB_GENERIC0 + index, v); + else + ERROR(); +} + + + +/* Unsigned integer-valued generic attributes. + * XXX: the integers just get converted to floats at this time + */ +static void GLAPIENTRY +TAG(VertexAttribI1ui)(GLuint index, GLuint x) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR1UI(0, x); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR1UI(VBO_ATTRIB_GENERIC0 + index, x); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI2ui)(GLuint index, GLuint x, GLuint y) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR2UI(0, x, y); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR2UI(VBO_ATTRIB_GENERIC0 + index, x, y); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI3ui)(GLuint index, GLuint x, GLuint y, GLuint z) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR3UI(0, x, y, z); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR3UI(VBO_ATTRIB_GENERIC0 + index, x, y, z); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR4UI(0, x, y, z, w); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR4UI(VBO_ATTRIB_GENERIC0 + index, x, y, z, w); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI2uiv)(GLuint index, const GLuint *v) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR2UIV(0, v); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR2UIV(VBO_ATTRIB_GENERIC0 + index, v); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI3uiv)(GLuint index, const GLuint *v) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR3UIV(0, v); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR3UIV(VBO_ATTRIB_GENERIC0 + index, v); + else + ERROR(); +} + +static void GLAPIENTRY +TAG(VertexAttribI4uiv)(GLuint index, const GLuint *v) +{ + GET_CURRENT_CONTEXT(ctx); + if (index == 0) + ATTR4UIV(0, v); + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) + ATTR4UIV(VBO_ATTRIB_GENERIC0 + index, v); + else + ERROR(); +} + + + /* 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. (See * vbo_save_loopback.c) */ -static void GLAPIENTRY TAG(VertexAttrib1fNV)( GLuint index, GLfloat x ) +static void GLAPIENTRY +TAG(VertexAttrib1fNV)(GLuint index, GLfloat x) { - GET_CURRENT_CONTEXT( ctx ); + GET_CURRENT_CONTEXT(ctx); if (index < VBO_ATTRIB_MAX) ATTR1F(index, x); } -static void GLAPIENTRY TAG(VertexAttrib1fvNV)( GLuint index, - const GLfloat *v ) +static void GLAPIENTRY +TAG(VertexAttrib1fvNV)(GLuint index, const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - if (index < VBO_ATTRIB_MAX) + GET_CURRENT_CONTEXT(ctx); + if (index < VBO_ATTRIB_MAX) ATTR1FV(index, v); } -static void GLAPIENTRY TAG(VertexAttrib2fNV)( GLuint index, GLfloat x, - GLfloat y ) +static void GLAPIENTRY +TAG(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y) { - GET_CURRENT_CONTEXT( ctx ); - if (index < VBO_ATTRIB_MAX) + GET_CURRENT_CONTEXT(ctx); + if (index < VBO_ATTRIB_MAX) ATTR2F(index, x, y); } -static void GLAPIENTRY TAG(VertexAttrib2fvNV)( GLuint index, - const GLfloat *v ) +static void GLAPIENTRY +TAG(VertexAttrib2fvNV)(GLuint index, const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - if (index < VBO_ATTRIB_MAX) + GET_CURRENT_CONTEXT(ctx); + if (index < VBO_ATTRIB_MAX) ATTR2FV(index, v); } -static void GLAPIENTRY TAG(VertexAttrib3fNV)( GLuint index, GLfloat x, - GLfloat y, GLfloat z ) +static void GLAPIENTRY +TAG(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z) { - GET_CURRENT_CONTEXT( ctx ); - if (index < VBO_ATTRIB_MAX) + GET_CURRENT_CONTEXT(ctx); + if (index < VBO_ATTRIB_MAX) ATTR3F(index, x, y, z); } -static void GLAPIENTRY TAG(VertexAttrib3fvNV)( GLuint index, - const GLfloat *v ) +static void GLAPIENTRY +TAG(VertexAttrib3fvNV)(GLuint index, + const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - if (index < VBO_ATTRIB_MAX) + GET_CURRENT_CONTEXT(ctx); + if (index < VBO_ATTRIB_MAX) ATTR3FV(index, v); } -static void GLAPIENTRY TAG(VertexAttrib4fNV)( GLuint index, GLfloat x, - GLfloat y, GLfloat z, - GLfloat w ) +static void GLAPIENTRY +TAG(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - GET_CURRENT_CONTEXT( ctx ); - if (index < VBO_ATTRIB_MAX) + GET_CURRENT_CONTEXT(ctx); + if (index < VBO_ATTRIB_MAX) ATTR4F(index, x, y, z, w); } -static void GLAPIENTRY TAG(VertexAttrib4fvNV)( GLuint index, - const GLfloat *v ) +static void GLAPIENTRY +TAG(VertexAttrib4fvNV)(GLuint index, const GLfloat * v) { - GET_CURRENT_CONTEXT( ctx ); - if (index < VBO_ATTRIB_MAX) + GET_CURRENT_CONTEXT(ctx); + if (index < VBO_ATTRIB_MAX) ATTR4FV(index, v); } + #define MAT( ATTR, N, face, params ) \ do { \ if (face != GL_BACK) \ @@ -438,32 +691,33 @@ do { \ /* Colormaterial conflicts are dealt with later. */ -static void GLAPIENTRY TAG(Materialfv)( GLenum face, GLenum pname, - const GLfloat *params ) +static void GLAPIENTRY +TAG(Materialfv)(GLenum face, GLenum pname, + const GLfloat * params) { - GET_CURRENT_CONTEXT( ctx ); + GET_CURRENT_CONTEXT(ctx); switch (pname) { case GL_EMISSION: - MAT( VBO_ATTRIB_MAT_FRONT_EMISSION, 4, face, params ); + MAT(VBO_ATTRIB_MAT_FRONT_EMISSION, 4, face, params); break; case GL_AMBIENT: - MAT( VBO_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); + MAT(VBO_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params); break; case GL_DIFFUSE: - MAT( VBO_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); + MAT(VBO_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params); break; case GL_SPECULAR: - MAT( VBO_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params ); + MAT(VBO_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params); break; case GL_SHININESS: - MAT( VBO_ATTRIB_MAT_FRONT_SHININESS, 1, face, params ); + MAT(VBO_ATTRIB_MAT_FRONT_SHININESS, 1, face, params); break; case GL_COLOR_INDEXES: - MAT( VBO_ATTRIB_MAT_FRONT_INDEXES, 3, face, params ); + MAT(VBO_ATTRIB_MAT_FRONT_INDEXES, 3, face, params); break; case GL_AMBIENT_AND_DIFFUSE: - MAT( VBO_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); - MAT( VBO_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); + MAT(VBO_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params); + MAT(VBO_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params); break; default: ERROR(); diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 1ef49174193..4988c51d44e 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -658,6 +658,24 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) vfmt->VertexAttrib4fNV = vbo_VertexAttrib4fNV; vfmt->VertexAttrib4fvNV = vbo_VertexAttrib4fvNV; + /* integer-valued */ + vfmt->VertexAttribI1i = vbo_VertexAttribI1i; + vfmt->VertexAttribI2i = vbo_VertexAttribI2i; + vfmt->VertexAttribI3i = vbo_VertexAttribI3i; + vfmt->VertexAttribI4i = vbo_VertexAttribI4i; + vfmt->VertexAttribI2iv = vbo_VertexAttribI2iv; + vfmt->VertexAttribI3iv = vbo_VertexAttribI3iv; + vfmt->VertexAttribI4iv = vbo_VertexAttribI4iv; + + /* unsigned integer-valued */ + vfmt->VertexAttribI1ui = vbo_VertexAttribI1ui; + vfmt->VertexAttribI2ui = vbo_VertexAttribI2ui; + vfmt->VertexAttribI3ui = vbo_VertexAttribI3ui; + vfmt->VertexAttribI4ui = vbo_VertexAttribI4ui; + vfmt->VertexAttribI2uiv = vbo_VertexAttribI2uiv; + vfmt->VertexAttribI3uiv = vbo_VertexAttribI3uiv; + vfmt->VertexAttribI4uiv = vbo_VertexAttribI4uiv; + vfmt->Materialfv = vbo_Materialfv; vfmt->EdgeFlag = vbo_EdgeFlag; diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index ca327b32f1f..817d478e2ac 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1065,6 +1065,24 @@ static void _save_vtxfmt_init( struct gl_context *ctx ) vfmt->VertexAttrib4fNV = _save_VertexAttrib4fNV; vfmt->VertexAttrib4fvNV = _save_VertexAttrib4fvNV; + /* integer-valued */ + vfmt->VertexAttribI1i = _save_VertexAttribI1i; + vfmt->VertexAttribI2i = _save_VertexAttribI2i; + vfmt->VertexAttribI3i = _save_VertexAttribI3i; + vfmt->VertexAttribI4i = _save_VertexAttribI4i; + vfmt->VertexAttribI2iv = _save_VertexAttribI2iv; + vfmt->VertexAttribI3iv = _save_VertexAttribI3iv; + vfmt->VertexAttribI4iv = _save_VertexAttribI4iv; + + /* unsigned integer-valued */ + vfmt->VertexAttribI1ui = _save_VertexAttribI1ui; + vfmt->VertexAttribI2ui = _save_VertexAttribI2ui; + vfmt->VertexAttribI3ui = _save_VertexAttribI3ui; + vfmt->VertexAttribI4ui = _save_VertexAttribI4ui; + vfmt->VertexAttribI2uiv = _save_VertexAttribI2uiv; + vfmt->VertexAttribI3uiv = _save_VertexAttribI3uiv; + vfmt->VertexAttribI4uiv = _save_VertexAttribI4uiv; + /* This will all require us to fallback to saving the list as opcodes: */ _MESA_INIT_DLIST_VTXFMT(vfmt, _save_); /* inside begin/end */ |