diff options
Diffstat (limited to 'src/mesa/tnl/t_vtx_api.c')
-rw-r--r-- | src/mesa/tnl/t_vtx_api.c | 130 |
1 files changed, 76 insertions, 54 deletions
diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index a9a1c5bd5f8..4f07e2cc7e2 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -97,6 +97,9 @@ static void _tnl_wrap_buffers( GLcontext *ctx ) } +/* Deal with buffer wrapping where provoked by the vertex buffer + * filling up, as opposed to upgrade_vertex(). + */ static void _tnl_wrap_filled_vertex( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -451,6 +454,24 @@ ATTRS( 13 ) ATTRS( 14 ) ATTRS( 15 ) + +static void error_attrib( const GLfloat *unused ) +{ + GET_CURRENT_CONTEXT( ctx ); + (void) unused; + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib" ); +} + +static void init_error_attrib( TNLcontext *tnl ) +{ + tnl->vtx.tabfv[ERROR_ATTRIB][0] = error_attrib; + tnl->vtx.tabfv[ERROR_ATTRIB][1] = error_attrib; + tnl->vtx.tabfv[ERROR_ATTRIB][2] = error_attrib; + tnl->vtx.tabfv[ERROR_ATTRIB][3] = error_attrib; +} + + + static void init_attrfv( TNLcontext *tnl ) { if (tnl->vtx.vertex_size) { @@ -472,6 +493,7 @@ static void init_attrfv( TNLcontext *tnl ) init_13( tnl ); init_14( tnl ); init_15( tnl ); + init_error_attrib( tnl ); for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) tnl->vtx.attrsz[i] = 0; @@ -545,7 +567,8 @@ static void GLAPIENTRY _tnl_Vertex3fv( const GLfloat *v ) DISPATCH_ATTR3FV( _TNL_ATTRIB_POS, v ); } -static void GLAPIENTRY _tnl_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +static void GLAPIENTRY _tnl_Vertex4f( GLfloat x, GLfloat y, GLfloat z, + GLfloat w ) { DISPATCH_ATTR4F( _TNL_ATTRIB_POS, x, y, z, w ); } @@ -585,7 +608,8 @@ static void GLAPIENTRY _tnl_TexCoord3fv( const GLfloat *v ) DISPATCH_ATTR3FV( _TNL_ATTRIB_TEX0, v ); } -static void GLAPIENTRY _tnl_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +static void GLAPIENTRY _tnl_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, + GLfloat w ) { DISPATCH_ATTR4F( _TNL_ATTRIB_TEX0, x, y, z, w ); } @@ -625,7 +649,8 @@ static void GLAPIENTRY _tnl_Color3fv( const GLfloat *v ) DISPATCH_ATTR3FV( _TNL_ATTRIB_COLOR0, v ); } -static void GLAPIENTRY _tnl_Color4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +static void GLAPIENTRY _tnl_Color4f( GLfloat x, GLfloat y, GLfloat z, + GLfloat w ) { DISPATCH_ATTR4F( _TNL_ATTRIB_COLOR0, x, y, z, w ); } @@ -635,7 +660,8 @@ static void GLAPIENTRY _tnl_Color4fv( const GLfloat *v ) DISPATCH_ATTR4FV( _TNL_ATTRIB_COLOR0, v ); } -static void GLAPIENTRY _tnl_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z ) +static void GLAPIENTRY _tnl_SecondaryColor3fEXT( GLfloat x, GLfloat y, + GLfloat z ) { DISPATCH_ATTR3F( _TNL_ATTRIB_COLOR1, x, y, z ); } @@ -651,45 +677,51 @@ static void GLAPIENTRY _tnl_MultiTexCoord1f( GLenum target, GLfloat x ) DISPATCH_ATTR1F( attr, x ); } -static void GLAPIENTRY _tnl_MultiTexCoord1fv( GLenum target, const GLfloat *v ) +static void GLAPIENTRY _tnl_MultiTexCoord1fv( GLenum target, + const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR1FV( attr, v ); } -static void GLAPIENTRY _tnl_MultiTexCoord2f( GLenum target, GLfloat x, GLfloat y ) +static void GLAPIENTRY _tnl_MultiTexCoord2f( GLenum target, GLfloat x, + GLfloat y ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR2F( attr, x, y ); } -static void GLAPIENTRY _tnl_MultiTexCoord2fv( GLenum target, const GLfloat *v ) +static void GLAPIENTRY _tnl_MultiTexCoord2fv( GLenum target, + const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR2FV( attr, v ); } -static void GLAPIENTRY _tnl_MultiTexCoord3f( GLenum target, GLfloat x, GLfloat y, - GLfloat z) +static void GLAPIENTRY _tnl_MultiTexCoord3f( GLenum target, GLfloat x, + GLfloat y, GLfloat z) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR3F( attr, x, y, z ); } -static void GLAPIENTRY _tnl_MultiTexCoord3fv( GLenum target, const GLfloat *v ) +static void GLAPIENTRY _tnl_MultiTexCoord3fv( GLenum target, + const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR3FV( attr, v ); } -static void GLAPIENTRY _tnl_MultiTexCoord4f( GLenum target, GLfloat x, GLfloat y, - GLfloat z, GLfloat w ) +static void GLAPIENTRY _tnl_MultiTexCoord4f( GLenum target, GLfloat x, + GLfloat y, GLfloat z, + GLfloat w ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR4F( attr, x, y, z, w ); } -static void GLAPIENTRY _tnl_MultiTexCoord4fv( GLenum target, const GLfloat *v ) +static void GLAPIENTRY _tnl_MultiTexCoord4fv( GLenum target, + const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR4FV( attr, v ); @@ -697,68 +729,58 @@ static void GLAPIENTRY _tnl_MultiTexCoord4fv( GLenum target, const GLfloat *v ) static void GLAPIENTRY _tnl_VertexAttrib1fNV( GLuint index, GLfloat x ) { - if (index < VERT_ATTRIB_MAX) - DISPATCH_ATTR1F( index, x ); - else - enum_error(); + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR1F( index, x ); } -static void GLAPIENTRY _tnl_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _tnl_VertexAttrib1fvNV( GLuint index, + const GLfloat *v ) { - if (index < VERT_ATTRIB_MAX) - DISPATCH_ATTR1FV( index, v ); - else - enum_error(); + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR1FV( index, v ); } -static void GLAPIENTRY _tnl_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) +static void GLAPIENTRY _tnl_VertexAttrib2fNV( GLuint index, GLfloat x, + GLfloat y ) { - if (index < VERT_ATTRIB_MAX) - DISPATCH_ATTR2F( index, x, y ); - else - enum_error(); + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR2F( index, x, y ); } -static void GLAPIENTRY _tnl_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _tnl_VertexAttrib2fvNV( GLuint index, + const GLfloat *v ) { - if (index < VERT_ATTRIB_MAX) - DISPATCH_ATTR2FV( index, v ); - else - enum_error(); + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR2FV( index, v ); } -static void GLAPIENTRY _tnl_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, - GLfloat z ) +static void GLAPIENTRY _tnl_VertexAttrib3fNV( GLuint index, GLfloat x, + GLfloat y, GLfloat z ) { - if (index < VERT_ATTRIB_MAX) - DISPATCH_ATTR3F( index, x, y, z ); - else - enum_error(); + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR3F( index, x, y, z ); } -static void GLAPIENTRY _tnl_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _tnl_VertexAttrib3fvNV( GLuint index, + const GLfloat *v ) { - if (index < VERT_ATTRIB_MAX) - DISPATCH_ATTR3FV( index, v ); - else - enum_error(); + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR3FV( index, v ); } -static void GLAPIENTRY _tnl_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, - GLfloat z, GLfloat w ) +static void GLAPIENTRY _tnl_VertexAttrib4fNV( GLuint index, GLfloat x, + GLfloat y, GLfloat z, + GLfloat w ) { - if (index < VERT_ATTRIB_MAX) - DISPATCH_ATTR4F( index, x, y, z, w ); - else - enum_error(); + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR4F( index, x, y, z, w ); } -static void GLAPIENTRY _tnl_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) +static void GLAPIENTRY _tnl_VertexAttrib4fvNV( GLuint index, + const GLfloat *v ) { - if (index < VERT_ATTRIB_MAX) - DISPATCH_ATTR4FV( index, v ); - else - enum_error(); + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR4FV( index, v ); } |