* the ctx->Current fields. The first 16 or so, anyway.
*/
COPY_CLEAN_4V(tnl->vtx.current[i],
- tnl->vtx.attrsz[i],
- tnl->vtx.attrptr[i]);
+ tnl->vtx.attrsz[i],
+ tnl->vtx.attrptr[i]);
}
}
*/
if (tnl->vtx.copied.nr)
{
- GLfloat *data = tnl->vtx.copied.buffer;
+ const GLfloat *data = tnl->vtx.copied.buffer;
GLfloat *dest = tnl->vtx.buffer;
GLuint j;
#define CHOOSE( ATTR, N ) \
static void choose_##ATTR##_##N( const GLfloat *v ) \
{ \
- tnl_attrfv_func f = do_choose(ATTR, N); \
+ tnl_attrfv_func f = do_choose(ATTR, N); \
f( v ); \
}
-#define CHOOSERS( ATTRIB ) \
- CHOOSE( ATTRIB, 1 ) \
- CHOOSE( ATTRIB, 2 ) \
- CHOOSE( ATTRIB, 3 ) \
- CHOOSE( ATTRIB, 4 ) \
+#define CHOOSERS( ATTRIB ) \
+ CHOOSE( ATTRIB, 1 ) \
+ CHOOSE( ATTRIB, 2 ) \
+ CHOOSE( ATTRIB, 3 ) \
+ CHOOSE( ATTRIB, 4 ) \
-#define INIT_CHOOSERS(ATTR) \
- choose[ATTR][0] = choose_##ATTR##_1; \
- choose[ATTR][1] = choose_##ATTR##_2; \
- choose[ATTR][2] = choose_##ATTR##_3; \
+#define INIT_CHOOSERS(ATTR) \
+ choose[ATTR][0] = choose_##ATTR##_1; \
+ choose[ATTR][1] = choose_##ATTR##_2; \
+ choose[ATTR][2] = choose_##ATTR##_3; \
choose[ATTR][3] = choose_##ATTR##_4;
CHOOSERS( 0 )
CHOOSERS( 14 )
CHOOSERS( 15 )
-static void error_attrib( const GLfloat *unused )
+
+
+/**
+ * This function will get called when glVertexAttribNV/ARB() is called
+ * with an invalid index parameter.
+ */
+static void
+error_attrib(const GLfloat *unused)
{
GET_CURRENT_CONTEXT( ctx );
(void) unused;
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib(index)" );
}
-static void reset_attrfv( TNLcontext *tnl )
+/**
+ * Reset all the per-vertex functions pointers to point to the default
+ * "chooser" functions.
+ */
+static void
+reset_attrfv(TNLcontext *tnl)
{
GLuint i;
-/* Materials:
+/**
+ * Materials:
*
* These are treated as per-vertex attributes, at indices above where
* the NV_vertex_program leaves off. There are a lot of good things
*
* There is no aliasing of material attributes with other entrypoints.
*/
-#define OTHER_ATTR( A, N, params ) \
+#define OTHER_ATTR( A, N, params ) \
do { \
if (tnl->vtx.attrsz[A] != N) { \
_tnl_fixup_vertex( ctx, A, N ); \
} while (0)
-#define MAT( ATTR, N, face, params ) \
-do { \
- if (face != GL_BACK) \
+#define MAT( ATTR, N, face, params ) \
+do { \
+ if (face != GL_BACK) \
OTHER_ATTR( ATTR, N, params ); /* front */ \
- if (face != GL_FRONT) \
+ if (face != GL_FRONT) \
OTHER_ATTR( ATTR + 1, N, params ); /* back */ \
} while (0)
-/* Colormaterial is dealt with later on.
+/**
+ * Called by glMaterialfv().
+ * Colormaterial is dealt with later on.
*/
-static void GLAPIENTRY _tnl_Materialfv( GLenum face, GLenum pname,
- const GLfloat *params )
+static void GLAPIENTRY
+_tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
case GL_BACK:
case GL_FRONT_AND_BACK:
break;
-
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glMaterialfv" );
return;
}
+/**
+ * Init the tnl->vtx->current[] pointers to point to the corresponding
+ * fields in ctx->Current attribute group.
+ */
static void _tnl_current_init( GLcontext *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLint i;
- /* setup the pointers for the typical 16 vertex attributes */
+ /* setup the pointers for the typical (32) vertex attributes */
for (i = 0; i < VERT_ATTRIB_MAX; i++)
tnl->vtx.current[i] = ctx->Current.Attrib[i];
tnl->vtx.current[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] =
ctx->Light.Material.Attrib[i];
+ /* special cases */
tnl->vtx.current[_TNL_ATTRIB_INDEX] = &ctx->Current.Index;
tnl->vtx.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->vtx.CurrentFloatEdgeFlag;
}