actx->nr_vbos = 0;
/* conventional vertex arrays */
- if (arrayObj->Index.Enabled) {
- aa->array = &arrayObj->Index;
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
+ aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- if (arrayObj->EdgeFlag.Enabled) {
- aa->array = &arrayObj->EdgeFlag;
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
+ aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG];
aa->offset = _gloffset_EdgeFlagv;
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- if (arrayObj->Normal.Enabled) {
- aa->array = &arrayObj->Normal;
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
+ aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL];
aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- if (arrayObj->Color.Enabled) {
- aa->array = &arrayObj->Color;
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
+ aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0];
aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- if (arrayObj->SecondaryColor.Enabled) {
- aa->array = &arrayObj->SecondaryColor;
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
+ aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1];
aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- if (arrayObj->FogCoord.Enabled) {
- aa->array = &arrayObj->FogCoord;
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
+ aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_FOG];
aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- struct gl_client_array *attribArray = &arrayObj->TexCoord[i];
+ struct gl_client_array *attribArray = &arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)];
if (attribArray->Enabled) {
/* NOTE: we use generic glVertexAttribNV functions here.
* If we ever remove GL_NV_vertex_program this will have to change.
}
/* generic vertex attribute arrays */
- for (i = 1; i < Elements(arrayObj->VertexAttrib); i++) { /* skip zero! */
- struct gl_client_array *attribArray = &arrayObj->VertexAttrib[i];
+ for (i = 1; i < VERT_ATTRIB_GENERIC_MAX; i++) { /* skip zero! */
+ struct gl_client_array *attribArray = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)];
if (attribArray->Enabled) {
at->array = attribArray;
/* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
}
/* finally, vertex position */
- if (arrayObj->VertexAttrib[0].Enabled) {
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled) {
/* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's
* issued as the last (provoking) attribute).
*/
- aa->array = &arrayObj->VertexAttrib[0];
+ aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0];
assert(aa->array->Size >= 2); /* XXX fix someday? */
aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- else if (arrayObj->Vertex.Enabled) {
- aa->array = &arrayObj->Vertex;
+ else if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) {
+ aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_POS];
aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
case API_OPENGLES:
/* For OpenGL ES, only draw if we have vertex positions
*/
- if (!ctx->Array.ArrayObj->Vertex.Enabled)
+ if (!ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled)
return GL_FALSE;
break;
#endif
/* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic
* array [0]).
*/
- return (ctx->Array.ArrayObj->Vertex.Enabled ||
- ctx->Array.ArrayObj->VertexAttrib[0].Enabled);
+ return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled ||
+ ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled);
}
}
break;
{
GLuint i;
- _mesa_reference_buffer_object(ctx, &obj->Vertex.BufferObj, NULL);
- _mesa_reference_buffer_object(ctx, &obj->Weight.BufferObj, NULL);
- _mesa_reference_buffer_object(ctx, &obj->Normal.BufferObj, NULL);
- _mesa_reference_buffer_object(ctx, &obj->Color.BufferObj, NULL);
- _mesa_reference_buffer_object(ctx, &obj->SecondaryColor.BufferObj, NULL);
- _mesa_reference_buffer_object(ctx, &obj->FogCoord.BufferObj, NULL);
- _mesa_reference_buffer_object(ctx, &obj->Index.BufferObj, NULL);
- _mesa_reference_buffer_object(ctx, &obj->EdgeFlag.BufferObj, NULL);
-
- for (i = 0; i < Elements(obj->TexCoord); i++)
- _mesa_reference_buffer_object(ctx, &obj->TexCoord[i].BufferObj, NULL);
-
for (i = 0; i < Elements(obj->VertexAttrib); i++)
- _mesa_reference_buffer_object(ctx, &obj->VertexAttrib[i].BufferObj,NULL);
-
-#if FEATURE_point_size_array
- _mesa_reference_buffer_object(ctx, &obj->PointSize.BufferObj, NULL);
-#endif
+ _mesa_reference_buffer_object(ctx, &obj->VertexAttrib[i].BufferObj, NULL);
}
obj->RefCount = 1;
/* Init the individual arrays */
- init_array(ctx, &obj->Vertex, 4, GL_FLOAT);
- init_array(ctx, &obj->Weight, 1, GL_FLOAT);
- init_array(ctx, &obj->Normal, 3, GL_FLOAT);
- init_array(ctx, &obj->Color, 4, GL_FLOAT);
- init_array(ctx, &obj->SecondaryColor, 3, GL_FLOAT);
- init_array(ctx, &obj->FogCoord, 1, GL_FLOAT);
- init_array(ctx, &obj->Index, 1, GL_FLOAT);
- for (i = 0; i < Elements(obj->TexCoord); i++) {
- init_array(ctx, &obj->TexCoord[i], 4, GL_FLOAT);
- }
- init_array(ctx, &obj->EdgeFlag, 1, GL_BOOL);
for (i = 0; i < Elements(obj->VertexAttrib); i++) {
- init_array(ctx, &obj->VertexAttrib[i], 4, GL_FLOAT);
- }
-
+ switch (i) {
+ case VERT_ATTRIB_WEIGHT:
+ init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_WEIGHT], 1, GL_FLOAT);
+ break;
+ case VERT_ATTRIB_NORMAL:
+ init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_NORMAL], 3, GL_FLOAT);
+ break;
+ case VERT_ATTRIB_COLOR1:
+ init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_COLOR1], 3, GL_FLOAT);
+ break;
+ case VERT_ATTRIB_FOG:
+ init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_FOG], 1, GL_FLOAT);
+ break;
+ case VERT_ATTRIB_COLOR_INDEX:
+ init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX], 1, GL_FLOAT);
+ break;
+ case VERT_ATTRIB_EDGEFLAG:
+ init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_EDGEFLAG], 1, GL_BOOL);
+ break;
#if FEATURE_point_size_array
- init_array(ctx, &obj->PointSize, 1, GL_FLOAT);
+ case VERT_ATTRIB_POINT_SIZE:
+ init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_POINT_SIZE], 1, GL_FLOAT);
+ break;
#endif
+ default:
+ init_array(ctx, &obj->VertexAttrib[i], 4, GL_FLOAT);
+ break;
+ }
+ }
_mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj,
ctx->Shared->NullBufferObj);
static GLuint
update_min(GLuint min, struct gl_client_array *array)
{
- if (array->Enabled) {
- _mesa_update_array_max_element(array);
- return MIN2(min, array->_MaxElement);
- }
- else
- return min;
+ assert(array->Enabled);
+ _mesa_update_array_max_element(array);
+ return MIN2(min, array->_MaxElement);
}
_mesa_update_array_object_max_element(struct gl_context *ctx,
struct gl_array_object *arrayObj)
{
- GLuint i, min = ~0;
-
- min = update_min(min, &arrayObj->Vertex);
- min = update_min(min, &arrayObj->Weight);
- min = update_min(min, &arrayObj->Normal);
- min = update_min(min, &arrayObj->Color);
- min = update_min(min, &arrayObj->SecondaryColor);
- min = update_min(min, &arrayObj->FogCoord);
- min = update_min(min, &arrayObj->Index);
- min = update_min(min, &arrayObj->EdgeFlag);
-#if FEATURE_point_size_array
- min = update_min(min, &arrayObj->PointSize);
-#endif
- for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++)
- min = update_min(min, &arrayObj->TexCoord[i]);
- for (i = 0; i < Elements(arrayObj->VertexAttrib); i++)
- min = update_min(min, &arrayObj->VertexAttrib[i]);
+ GLbitfield64 enabled = arrayObj->_Enabled;
+ GLuint min = ~0u;
+
+ while (enabled) {
+ GLint attrib = _mesa_ffsll(enabled) - 1;
+ enabled &= ~BITFIELD64_BIT(attrib);
+ min = update_min(min, &arrayObj->VertexAttrib[attrib]);
+ }
/* _MaxElement is one past the last legal array element */
arrayObj->_MaxElement = min;
/* In theory must be the same anyway, but on recreate make sure it matches */
dest->VBOonly = src->VBOonly;
- _mesa_copy_client_array(ctx, &dest->Vertex, &src->Vertex);
- _mesa_copy_client_array(ctx, &dest->Weight, &src->Weight);
- _mesa_copy_client_array(ctx, &dest->Normal, &src->Normal);
- _mesa_copy_client_array(ctx, &dest->Color, &src->Color);
- _mesa_copy_client_array(ctx, &dest->SecondaryColor, &src->SecondaryColor);
- _mesa_copy_client_array(ctx, &dest->FogCoord, &src->FogCoord);
- _mesa_copy_client_array(ctx, &dest->Index, &src->Index);
- _mesa_copy_client_array(ctx, &dest->EdgeFlag, &src->EdgeFlag);
-#if FEATURE_point_size_array
- _mesa_copy_client_array(ctx, &dest->PointSize, &src->PointSize);
-#endif
- for (i = 0; i < Elements(src->TexCoord); i++)
- _mesa_copy_client_array(ctx, &dest->TexCoord[i], &src->TexCoord[i]);
for (i = 0; i < Elements(src->VertexAttrib); i++)
_mesa_copy_client_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]);
}
/* unbind any vertex pointers bound to this buffer */
- unbind(ctx, &arrayObj->Vertex.BufferObj, bufObj);
- unbind(ctx, &arrayObj->Weight.BufferObj, bufObj);
- unbind(ctx, &arrayObj->Normal.BufferObj, bufObj);
- unbind(ctx, &arrayObj->Color.BufferObj, bufObj);
- unbind(ctx, &arrayObj->SecondaryColor.BufferObj, bufObj);
- unbind(ctx, &arrayObj->FogCoord.BufferObj, bufObj);
- unbind(ctx, &arrayObj->Index.BufferObj, bufObj);
- unbind(ctx, &arrayObj->EdgeFlag.BufferObj, bufObj);
- for (j = 0; j < Elements(arrayObj->TexCoord); j++) {
- unbind(ctx, &arrayObj->TexCoord[j].BufferObj, bufObj);
- }
for (j = 0; j < Elements(arrayObj->VertexAttrib); j++) {
unbind(ctx, &arrayObj->VertexAttrib[j].BufferObj, bufObj);
}
switch (cap) {
case GL_VERTEX_ARRAY:
- var = &arrayObj->Vertex.Enabled;
+ var = &arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled;
flag = VERT_BIT_POS;
break;
case GL_NORMAL_ARRAY:
- var = &arrayObj->Normal.Enabled;
+ var = &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled;
flag = VERT_BIT_NORMAL;
break;
case GL_COLOR_ARRAY:
- var = &arrayObj->Color.Enabled;
+ var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled;
flag = VERT_BIT_COLOR0;
break;
case GL_INDEX_ARRAY:
- var = &arrayObj->Index.Enabled;
+ var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled;
flag = VERT_BIT_COLOR_INDEX;
break;
case GL_TEXTURE_COORD_ARRAY:
- var = &arrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled;
+ var = &arrayObj->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].Enabled;
flag = VERT_BIT_TEX(ctx->Array.ActiveTexture);
break;
case GL_EDGE_FLAG_ARRAY:
- var = &arrayObj->EdgeFlag.Enabled;
+ var = &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled;
flag = VERT_BIT_EDGEFLAG;
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
- var = &arrayObj->FogCoord.Enabled;
+ var = &arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled;
flag = VERT_BIT_FOG;
break;
case GL_SECONDARY_COLOR_ARRAY_EXT:
- var = &arrayObj->SecondaryColor.Enabled;
+ var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled;
flag = VERT_BIT_COLOR1;
break;
#if FEATURE_point_size_array
case GL_POINT_SIZE_ARRAY_OES:
- var = &arrayObj->PointSize.Enabled;
+ var = &arrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled;
flag = VERT_BIT_POINT_SIZE;
break;
#endif
CHECK_EXTENSION(NV_vertex_program, cap);
{
GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
- ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib));
- var = &arrayObj->VertexAttrib[n].Enabled;
+ ASSERT(VERT_ATTRIB_GENERIC(n) < Elements(ctx->Array.ArrayObj->VertexAttrib));
+ var = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(n)].Enabled;
flag = VERT_BIT_GENERIC(n);
}
break;
/* client-side state */
case GL_VERTEX_ARRAY:
- return (ctx->Array.ArrayObj->Vertex.Enabled != 0);
+ return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled != 0);
case GL_NORMAL_ARRAY:
- return (ctx->Array.ArrayObj->Normal.Enabled != 0);
+ return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled != 0);
case GL_COLOR_ARRAY:
- return (ctx->Array.ArrayObj->Color.Enabled != 0);
+ return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled != 0);
case GL_INDEX_ARRAY:
- return (ctx->Array.ArrayObj->Index.Enabled != 0);
+ return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled != 0);
case GL_TEXTURE_COORD_ARRAY:
- return (ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture]
+ return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)]
.Enabled != 0);
case GL_EDGE_FLAG_ARRAY:
- return (ctx->Array.ArrayObj->EdgeFlag.Enabled != 0);
+ return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled != 0);
case GL_FOG_COORDINATE_ARRAY_EXT:
CHECK_EXTENSION(EXT_fog_coord);
- return (ctx->Array.ArrayObj->FogCoord.Enabled != 0);
+ return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled != 0);
case GL_SECONDARY_COLOR_ARRAY_EXT:
CHECK_EXTENSION(EXT_secondary_color);
- return (ctx->Array.ArrayObj->SecondaryColor.Enabled != 0);
+ return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled != 0);
#if FEATURE_point_size_array
case GL_POINT_SIZE_ARRAY_OES:
- return (ctx->Array.ArrayObj->PointSize.Enabled != 0);
+ return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled != 0);
#endif
/* GL_ARB_texture_cube_map */
CHECK_EXTENSION(NV_vertex_program);
{
GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
- ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib));
- return (ctx->Array.ArrayObj->VertexAttrib[n].Enabled != 0);
+ ASSERT(VERT_ATTRIB_GENERIC(n) < Elements(ctx->Array.ArrayObj->VertexAttrib));
+ return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(n)].Enabled != 0);
}
case GL_MAP1_VERTEX_ATTRIB0_4_NV:
case GL_MAP1_VERTEX_ATTRIB1_4_NV:
{ GL_TEXTURE_STACK_DEPTH, LOC_CUSTOM, TYPE_INT, 0,
extra_valid_texture_unit },
- { GL_VERTEX_ARRAY, ARRAY_BOOL(Vertex.Enabled), NO_EXTRA },
- { GL_VERTEX_ARRAY_SIZE, ARRAY_INT(Vertex.Size), NO_EXTRA },
- { GL_VERTEX_ARRAY_TYPE, ARRAY_ENUM(Vertex.Type), NO_EXTRA },
- { GL_VERTEX_ARRAY_STRIDE, ARRAY_INT(Vertex.Stride), NO_EXTRA },
- { GL_NORMAL_ARRAY, ARRAY_BOOL(Normal.Enabled), NO_EXTRA },
- { GL_NORMAL_ARRAY_TYPE, ARRAY_ENUM(Normal.Type), NO_EXTRA },
- { GL_NORMAL_ARRAY_STRIDE, ARRAY_INT(Normal.Stride), NO_EXTRA },
- { GL_COLOR_ARRAY, ARRAY_BOOL(Color.Enabled), NO_EXTRA },
- { GL_COLOR_ARRAY_SIZE, ARRAY_INT(Color.Size), NO_EXTRA },
- { GL_COLOR_ARRAY_TYPE, ARRAY_ENUM(Color.Type), NO_EXTRA },
- { GL_COLOR_ARRAY_STRIDE, ARRAY_INT(Color.Stride), NO_EXTRA },
+ { GL_VERTEX_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_POS].Enabled), NO_EXTRA },
+ { GL_VERTEX_ARRAY_SIZE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_POS].Size), NO_EXTRA },
+ { GL_VERTEX_ARRAY_TYPE, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_POS].Type), NO_EXTRA },
+ { GL_VERTEX_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_POS].Stride), NO_EXTRA },
+ { GL_NORMAL_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_NORMAL].Enabled), NO_EXTRA },
+ { GL_NORMAL_ARRAY_TYPE, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_NORMAL].Type), NO_EXTRA },
+ { GL_NORMAL_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_NORMAL].Stride), NO_EXTRA },
+ { GL_COLOR_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR0].Enabled), NO_EXTRA },
+ { GL_COLOR_ARRAY_SIZE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Size), NO_EXTRA },
+ { GL_COLOR_ARRAY_TYPE, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR0].Type), NO_EXTRA },
+ { GL_COLOR_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Stride), NO_EXTRA },
{ GL_TEXTURE_COORD_ARRAY,
LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Enabled), NO_EXTRA },
{ GL_TEXTURE_COORD_ARRAY_SIZE,
/* GL_ARB_vertex_buffer_object */
{ GL_VERTEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
- offsetof(struct gl_array_object, Vertex.BufferObj), NO_EXTRA },
+ offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_POS].BufferObj), NO_EXTRA },
{ GL_NORMAL_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
- offsetof(struct gl_array_object, Normal.BufferObj), NO_EXTRA },
+ offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_NORMAL].BufferObj), NO_EXTRA },
{ GL_COLOR_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
- offsetof(struct gl_array_object, Color.BufferObj), NO_EXTRA },
+ offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR0].BufferObj), NO_EXTRA },
{ GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA },
/* GL_OES_point_sprite */
{ GL_VERTEX_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA },
{ GL_NORMAL_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA },
{ GL_COLOR_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA },
- { GL_INDEX_ARRAY, ARRAY_BOOL(Index.Enabled), NO_EXTRA },
- { GL_INDEX_ARRAY_TYPE, ARRAY_ENUM(Index.Type), NO_EXTRA },
- { GL_INDEX_ARRAY_STRIDE, ARRAY_INT(Index.Stride), NO_EXTRA },
+ { GL_INDEX_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled), NO_EXTRA },
+ { GL_INDEX_ARRAY_TYPE, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Type), NO_EXTRA },
+ { GL_INDEX_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Stride), NO_EXTRA },
{ GL_INDEX_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA },
{ GL_TEXTURE_COORD_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA },
- { GL_EDGE_FLAG_ARRAY, ARRAY_BOOL(EdgeFlag.Enabled), NO_EXTRA },
- { GL_EDGE_FLAG_ARRAY_STRIDE, ARRAY_INT(EdgeFlag.Stride), NO_EXTRA },
+ { GL_EDGE_FLAG_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled), NO_EXTRA },
+ { GL_EDGE_FLAG_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_EDGEFLAG].Stride), NO_EXTRA },
{ GL_EDGE_FLAG_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA },
/* GL_ARB_texture_compression */
{ GL_CURRENT_SECONDARY_COLOR_EXT,
CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_COLOR1][0], TYPE_FLOATN_4),
extra_EXT_secondary_color_flush_current },
- { GL_SECONDARY_COLOR_ARRAY_EXT, ARRAY_BOOL(SecondaryColor.Enabled),
+ { GL_SECONDARY_COLOR_ARRAY_EXT, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR1].Enabled),
extra_EXT_secondary_color },
- { GL_SECONDARY_COLOR_ARRAY_TYPE_EXT, ARRAY_ENUM(SecondaryColor.Type),
+ { GL_SECONDARY_COLOR_ARRAY_TYPE_EXT, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR1].Type),
extra_EXT_secondary_color },
- { GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT, ARRAY_INT(SecondaryColor.Stride),
+ { GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Stride),
extra_EXT_secondary_color },
- { GL_SECONDARY_COLOR_ARRAY_SIZE_EXT, ARRAY_INT(SecondaryColor.Size),
+ { GL_SECONDARY_COLOR_ARRAY_SIZE_EXT, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Size),
extra_EXT_secondary_color },
/* GL_EXT_fog_coord */
{ GL_CURRENT_FOG_COORDINATE_EXT,
CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_FOG][0]),
extra_EXT_fog_coord_flush_current },
- { GL_FOG_COORDINATE_ARRAY_EXT, ARRAY_BOOL(FogCoord.Enabled),
+ { GL_FOG_COORDINATE_ARRAY_EXT, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_FOG].Enabled),
extra_EXT_fog_coord },
- { GL_FOG_COORDINATE_ARRAY_TYPE_EXT, ARRAY_ENUM(FogCoord.Type),
+ { GL_FOG_COORDINATE_ARRAY_TYPE_EXT, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_FOG].Type),
extra_EXT_fog_coord },
- { GL_FOG_COORDINATE_ARRAY_STRIDE_EXT, ARRAY_INT(FogCoord.Stride),
+ { GL_FOG_COORDINATE_ARRAY_STRIDE_EXT, ARRAY_INT(VertexAttrib[VERT_ATTRIB_FOG].Stride),
extra_EXT_fog_coord },
{ GL_FOG_COORDINATE_SOURCE_EXT, CONTEXT_ENUM(Fog.FogCoordinateSource),
extra_EXT_fog_coord },
/* GL_NV_vertex_program */
{ GL_VERTEX_PROGRAM_BINDING_NV, LOC_CUSTOM, TYPE_INT, 0,
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY0_NV, ARRAY_BOOL(VertexAttrib[0].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY0_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(0)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY1_NV, ARRAY_BOOL(VertexAttrib[1].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY1_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(1)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY2_NV, ARRAY_BOOL(VertexAttrib[2].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY2_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(2)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY3_NV, ARRAY_BOOL(VertexAttrib[3].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY3_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(3)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY4_NV, ARRAY_BOOL(VertexAttrib[4].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY4_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(4)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY5_NV, ARRAY_BOOL(VertexAttrib[5].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY5_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(5)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY6_NV, ARRAY_BOOL(VertexAttrib[6].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY6_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(6)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY7_NV, ARRAY_BOOL(VertexAttrib[7].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY7_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(7)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY8_NV, ARRAY_BOOL(VertexAttrib[8].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY8_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(8)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY9_NV, ARRAY_BOOL(VertexAttrib[9].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY9_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(9)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY10_NV, ARRAY_BOOL(VertexAttrib[10].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY10_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(10)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY11_NV, ARRAY_BOOL(VertexAttrib[11].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY11_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(11)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY12_NV, ARRAY_BOOL(VertexAttrib[12].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY12_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(12)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY13_NV, ARRAY_BOOL(VertexAttrib[13].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY13_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(13)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY14_NV, ARRAY_BOOL(VertexAttrib[14].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY14_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(14)].Enabled),
extra_NV_vertex_program },
- { GL_VERTEX_ATTRIB_ARRAY15_NV, ARRAY_BOOL(VertexAttrib[15].Enabled),
+ { GL_VERTEX_ATTRIB_ARRAY15_NV, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_GENERIC(15)].Enabled),
extra_NV_vertex_program },
{ GL_MAP1_VERTEX_ATTRIB0_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[0]),
extra_NV_vertex_program },
/* GL_ARB_vertex_buffer_object */
{ GL_INDEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
- offsetof(struct gl_array_object, Index.BufferObj), NO_EXTRA },
+ offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR_INDEX].BufferObj), NO_EXTRA },
{ GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
- offsetof(struct gl_array_object, EdgeFlag.BufferObj), NO_EXTRA },
+ offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_EDGEFLAG].BufferObj), NO_EXTRA },
{ GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
- offsetof(struct gl_array_object, SecondaryColor.BufferObj), NO_EXTRA },
+ offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR1].BufferObj), NO_EXTRA },
{ GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
- offsetof(struct gl_array_object, FogCoord.BufferObj), NO_EXTRA },
+ offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_FOG].BufferObj), NO_EXTRA },
/* GL_EXT_pixel_buffer_object */
{ GL_PIXEL_PACK_BUFFER_BINDING_EXT, LOC_CUSTOM, TYPE_INT, 0,
case GL_TEXTURE_COORD_ARRAY_SIZE:
case GL_TEXTURE_COORD_ARRAY_TYPE:
case GL_TEXTURE_COORD_ARRAY_STRIDE:
- array = &ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture];
+ array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)];
v->value_int = *(GLuint *) ((char *) array + d->offset);
break;
break;
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
v->value_int =
- ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name;
+ ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].BufferObj->Name;
break;
case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
v->value_int = ctx->Array.ArrayObj->ElementArrayBufferObj->Name;
ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0;
break;
case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
- v->value_int = ctx->Array.ArrayObj->PointSize.BufferObj->Name;
+ v->value_int = ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].BufferObj->Name;
break;
case GL_FOG_COLOR:
switch (pname) {
case GL_VERTEX_ARRAY_POINTER:
- *params = (GLvoid *) ctx->Array.ArrayObj->Vertex.Ptr;
+ *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Ptr;
break;
case GL_NORMAL_ARRAY_POINTER:
- *params = (GLvoid *) ctx->Array.ArrayObj->Normal.Ptr;
+ *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Ptr;
break;
case GL_COLOR_ARRAY_POINTER:
- *params = (GLvoid *) ctx->Array.ArrayObj->Color.Ptr;
+ *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Ptr;
break;
case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT:
- *params = (GLvoid *) ctx->Array.ArrayObj->SecondaryColor.Ptr;
+ *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Ptr;
break;
case GL_FOG_COORDINATE_ARRAY_POINTER_EXT:
- *params = (GLvoid *) ctx->Array.ArrayObj->FogCoord.Ptr;
+ *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Ptr;
break;
case GL_INDEX_ARRAY_POINTER:
- *params = (GLvoid *) ctx->Array.ArrayObj->Index.Ptr;
+ *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Ptr;
break;
case GL_TEXTURE_COORD_ARRAY_POINTER:
- *params = (GLvoid *) ctx->Array.ArrayObj->TexCoord[clientUnit].Ptr;
+ *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(clientUnit)].Ptr;
break;
case GL_EDGE_FLAG_ARRAY_POINTER:
- *params = (GLvoid *) ctx->Array.ArrayObj->EdgeFlag.Ptr;
+ *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr;
break;
case GL_FEEDBACK_BUFFER_POINTER:
*params = ctx->Feedback.Buffer;
break;
#if FEATURE_point_size_array
case GL_POINT_SIZE_ARRAY_POINTER_OES:
- *params = (GLvoid *) ctx->Array.ArrayObj->PointSize.Ptr;
+ *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Ptr;
break;
#endif
default:
VERT_ATTRIB_COLOR1 = 4,
VERT_ATTRIB_FOG = 5,
VERT_ATTRIB_COLOR_INDEX = 6,
- VERT_ATTRIB_POINT_SIZE = 6, /*alias*/
VERT_ATTRIB_EDGEFLAG = 7,
VERT_ATTRIB_TEX0 = 8,
VERT_ATTRIB_TEX1 = 9,
VERT_ATTRIB_TEX5 = 13,
VERT_ATTRIB_TEX6 = 14,
VERT_ATTRIB_TEX7 = 15,
- VERT_ATTRIB_GENERIC0 = 16,
- VERT_ATTRIB_GENERIC1 = 17,
- VERT_ATTRIB_GENERIC2 = 18,
- VERT_ATTRIB_GENERIC3 = 19,
- VERT_ATTRIB_GENERIC4 = 20,
- VERT_ATTRIB_GENERIC5 = 21,
- VERT_ATTRIB_GENERIC6 = 22,
- VERT_ATTRIB_GENERIC7 = 23,
- VERT_ATTRIB_GENERIC8 = 24,
- VERT_ATTRIB_GENERIC9 = 25,
- VERT_ATTRIB_GENERIC10 = 26,
- VERT_ATTRIB_GENERIC11 = 27,
- VERT_ATTRIB_GENERIC12 = 28,
- VERT_ATTRIB_GENERIC13 = 29,
- VERT_ATTRIB_GENERIC14 = 30,
- VERT_ATTRIB_GENERIC15 = 31,
- VERT_ATTRIB_MAX = 32
+ VERT_ATTRIB_POINT_SIZE = 16,
+ VERT_ATTRIB_GENERIC0 = 17,
+ VERT_ATTRIB_GENERIC1 = 18,
+ VERT_ATTRIB_GENERIC2 = 19,
+ VERT_ATTRIB_GENERIC3 = 20,
+ VERT_ATTRIB_GENERIC4 = 21,
+ VERT_ATTRIB_GENERIC5 = 22,
+ VERT_ATTRIB_GENERIC6 = 23,
+ VERT_ATTRIB_GENERIC7 = 24,
+ VERT_ATTRIB_GENERIC8 = 25,
+ VERT_ATTRIB_GENERIC9 = 26,
+ VERT_ATTRIB_GENERIC10 = 27,
+ VERT_ATTRIB_GENERIC11 = 28,
+ VERT_ATTRIB_GENERIC12 = 29,
+ VERT_ATTRIB_GENERIC13 = 30,
+ VERT_ATTRIB_GENERIC14 = 31,
+ VERT_ATTRIB_GENERIC15 = 32,
+ VERT_ATTRIB_MAX = 33
} gl_vert_attrib;
/**
#define VERT_BIT_COLOR1 BITFIELD64_BIT(VERT_ATTRIB_COLOR1)
#define VERT_BIT_FOG BITFIELD64_BIT(VERT_ATTRIB_FOG)
#define VERT_BIT_COLOR_INDEX BITFIELD64_BIT(VERT_ATTRIB_COLOR_INDEX)
-#define VERT_BIT_POINT_SIZE BITFIELD64_BIT(VERT_ATTRIB_POINT_SIZE)
#define VERT_BIT_EDGEFLAG BITFIELD64_BIT(VERT_ATTRIB_EDGEFLAG)
#define VERT_BIT_TEX0 BITFIELD64_BIT(VERT_ATTRIB_TEX0)
#define VERT_BIT_TEX1 BITFIELD64_BIT(VERT_ATTRIB_TEX1)
#define VERT_BIT_TEX5 BITFIELD64_BIT(VERT_ATTRIB_TEX5)
#define VERT_BIT_TEX6 BITFIELD64_BIT(VERT_ATTRIB_TEX6)
#define VERT_BIT_TEX7 BITFIELD64_BIT(VERT_ATTRIB_TEX7)
+#define VERT_BIT_POINT_SIZE BITFIELD64_BIT(VERT_ATTRIB_POINT_SIZE)
#define VERT_BIT_GENERIC0 BITFIELD64_BIT(VERT_ATTRIB_GENERIC0)
#define VERT_BIT(i) BITFIELD64_BIT(i)
_glthread_Mutex Mutex;
GLboolean VBOonly; /**< require all arrays to live in VBOs? */
- /** Conventional vertex arrays */
- /*@{*/
- struct gl_client_array Vertex;
- struct gl_client_array Weight;
- struct gl_client_array Normal;
- struct gl_client_array Color;
- struct gl_client_array SecondaryColor;
- struct gl_client_array FogCoord;
- struct gl_client_array Index;
- struct gl_client_array EdgeFlag;
- struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
- struct gl_client_array PointSize;
- /*@}*/
-
- /**
- * Generic arrays for vertex programs/shaders.
- * For NV vertex programs, these attributes alias and take priority
- * over the conventional attribs above. For ARB vertex programs and
- * GLSL vertex shaders, these attributes are separate.
- */
- struct gl_client_array VertexAttrib[MAX_VERTEX_GENERIC_ATTRIBS];
+ /** Vertex attribute arrays */
+ struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];
/** Mask of VERT_BIT_* values indicating which arrays are enabled */
GLbitfield64 _Enabled;
return;
}
- array = &ctx->Array.ArrayObj->VertexAttrib[index];
+ array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)];
switch (pname) {
case GL_ATTRIB_ARRAY_SIZE_NV:
return;
}
- array = &ctx->Array.ArrayObj->VertexAttrib[index];
+ array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)];
switch (pname) {
case GL_ATTRIB_ARRAY_SIZE_NV:
return;
}
- array = &ctx->Array.ArrayObj->VertexAttrib[index];
+ array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)];
switch (pname) {
case GL_ATTRIB_ARRAY_SIZE_NV:
return;
}
- *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr;
+ *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Ptr;
}
void
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
GLuint i, min = ~0;
- /* find min of _MaxElement values for all enabled arrays */
+ /* find min of _MaxElement values for all enabled arrays.
+ * Note that the generic arrays always take precedence over
+ * the legacy arrays.
+ */
/* 0 */
if (ctx->VertexProgram._Current
- && arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]);
+ && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0]);
}
- else if (arrayObj->Vertex.Enabled) {
- min = update_min(min, &arrayObj->Vertex);
+ else if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]);
}
/* 1 */
if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT]);
+ && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC1].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC1]);
}
/* no conventional vertex weight array */
/* 2 */
if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]);
+ && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC2].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC2]);
}
- else if (arrayObj->Normal.Enabled) {
- min = update_min(min, &arrayObj->Normal);
+ else if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]);
}
/* 3 */
if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]);
+ && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC3].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC3]);
}
- else if (arrayObj->Color.Enabled) {
- min = update_min(min, &arrayObj->Color);
+ else if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]);
}
/* 4 */
if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]);
+ && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC4].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC4]);
}
- else if (arrayObj->SecondaryColor.Enabled) {
- min = update_min(min, &arrayObj->SecondaryColor);
+ else if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]);
}
/* 5 */
if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_FOG]);
+ && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC5].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC5]);
}
- else if (arrayObj->FogCoord.Enabled) {
- min = update_min(min, &arrayObj->FogCoord);
+ else if (arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_FOG]);
}
/* 6 */
if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]);
+ && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC6].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC6]);
}
- else if (arrayObj->Index.Enabled) {
- min = update_min(min, &arrayObj->Index);
+ else if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]);
}
/* 7 */
if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]);
+ && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC7].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC7]);
}
/* 8..15 */
- for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++) {
+ for (i = 0; i < VERT_ATTRIB_TEX_MAX; i++) {
if (ctx->VertexProgram._Enabled
- && arrayObj->VertexAttrib[i].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[i]);
+ && arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC8 + i].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC8 + i]);
}
- else if (i - VERT_ATTRIB_TEX0 < ctx->Const.MaxTextureCoordUnits
- && arrayObj->TexCoord[i - VERT_ATTRIB_TEX0].Enabled) {
- min = update_min(min, &arrayObj->TexCoord[i - VERT_ATTRIB_TEX0]);
+ else if (i < ctx->Const.MaxTextureCoordUnits
+ && arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)]);
}
}
/* 16..31 */
if (ctx->VertexProgram._Current) {
- for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) {
- if (arrayObj->VertexAttrib[i].Enabled) {
- min = update_min(min, &arrayObj->VertexAttrib[i]);
+ for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)]);
}
}
}
- if (arrayObj->EdgeFlag.Enabled) {
- min = update_min(min, &arrayObj->EdgeFlag);
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
+ min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]);
}
/* _MaxElement is one past the last legal array element */
* functions.
*
* \param func name of calling function used for error reporting
- * \param array the array to update
- * \param dirtyBit which bit to set in ctx->Array.NewState for this array
+ * \param attrib the attribute array index to update
* \param legalTypes bitmask of *_BIT above indicating legal datatypes
* \param sizeMin min allowable size value
* \param sizeMax max allowable size value (may also be BGRA_OR_4)
static void
update_array(struct gl_context *ctx,
const char *func,
- struct gl_client_array *array,
- GLbitfield64 dirtyBit, GLbitfield legalTypesMask,
+ GLuint attrib, GLbitfield legalTypesMask,
GLint sizeMin, GLint sizeMax,
GLint size, GLenum type, GLsizei stride,
GLboolean normalized, GLboolean integer,
const GLvoid *ptr)
{
+ struct gl_client_array *array;
GLbitfield typeBit;
GLsizei elementSize;
GLenum format = GL_RGBA;
elementSize = _mesa_sizeof_type(type) * size;
+ array = &ctx->Array.ArrayObj->VertexAttrib[attrib];
array->Size = size;
array->Type = type;
array->Format = format;
ctx->Array.ArrayBufferObj);
ctx->NewState |= _NEW_ARRAY;
- ctx->Array.NewState |= dirtyBit;
+ ctx->Array.NewState |= VERT_BIT(attrib);
}
if (ctx->API == API_OPENGLES)
legalTypes |= BYTE_BIT;
- update_array(ctx, "glVertexPointer",
- &ctx->Array.ArrayObj->Vertex, VERT_BIT_POS,
+ update_array(ctx, "glVertexPointer", VERT_ATTRIB_POS,
legalTypes, 2, 4,
size, type, stride, GL_FALSE, GL_FALSE, ptr);
}
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- update_array(ctx, "glNormalPointer",
- &ctx->Array.ArrayObj->Normal, VERT_BIT_NORMAL,
+ update_array(ctx, "glNormalPointer", VERT_ATTRIB_NORMAL,
legalTypes, 3, 3,
3, type, stride, GL_TRUE, GL_FALSE, ptr);
}
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- update_array(ctx, "glColorPointer",
- &ctx->Array.ArrayObj->Color, VERT_BIT_COLOR0,
+ update_array(ctx, "glColorPointer", VERT_ATTRIB_COLOR0,
legalTypes, 3, BGRA_OR_4,
size, type, stride, GL_TRUE, GL_FALSE, ptr);
}
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- update_array(ctx, "glFogCoordPointer",
- &ctx->Array.ArrayObj->FogCoord, VERT_BIT_FOG,
+ update_array(ctx, "glFogCoordPointer", VERT_ATTRIB_FOG,
legalTypes, 1, 1,
1, type, stride, GL_FALSE, GL_FALSE, ptr);
}
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- update_array(ctx, "glIndexPointer",
- &ctx->Array.ArrayObj->Index, VERT_BIT_COLOR_INDEX,
+ update_array(ctx, "glIndexPointer", VERT_ATTRIB_COLOR_INDEX,
legalTypes, 1, 1,
1, type, stride, GL_FALSE, GL_FALSE, ptr);
}
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- update_array(ctx, "glSecondaryColorPointer",
- &ctx->Array.ArrayObj->SecondaryColor, VERT_BIT_COLOR1,
+ update_array(ctx, "glSecondaryColorPointer", VERT_ATTRIB_COLOR1,
legalTypes, 3, BGRA_OR_4,
size, type, stride, GL_TRUE, GL_FALSE, ptr);
}
ASSERT(unit < Elements(ctx->Array.ArrayObj->TexCoord));
- update_array(ctx, "glTexCoordPointer",
- &ctx->Array.ArrayObj->TexCoord[unit],
- VERT_BIT_TEX(unit),
+ update_array(ctx, "glTexCoordPointer", VERT_ATTRIB_TEX(unit),
legalTypes, 1, 4,
size, type, stride, GL_FALSE, GL_FALSE,
ptr);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- update_array(ctx, "glEdgeFlagPointer",
- &ctx->Array.ArrayObj->EdgeFlag, VERT_BIT_EDGEFLAG,
+ update_array(ctx, "glEdgeFlagPointer", VERT_ATTRIB_EDGEFLAG,
legalTypes, 1, 1,
1, GL_UNSIGNED_BYTE, stride, GL_FALSE, integer, ptr);
}
return;
}
- update_array(ctx, "glPointSizePointer",
- &ctx->Array.ArrayObj->PointSize, VERT_BIT_POINT_SIZE,
+ update_array(ctx, "glPointSizePointer", VERT_ATTRIB_POINT_SIZE,
legalTypes, 1, 1,
1, type, stride, GL_FALSE, GL_FALSE, ptr);
}
return;
}
- update_array(ctx, "glVertexAttribPointerNV",
- &ctx->Array.ArrayObj->VertexAttrib[index],
- VERT_BIT_GENERIC(index),
+ update_array(ctx, "glVertexAttribPointerNV", VERT_ATTRIB_GENERIC(index),
legalTypes, 1, BGRA_OR_4,
size, type, stride, normalized, GL_FALSE, ptr);
}
return;
}
- update_array(ctx, "glVertexAttribPointer",
- &ctx->Array.ArrayObj->VertexAttrib[index],
- VERT_BIT_GENERIC(index),
+ update_array(ctx, "glVertexAttribPointer", VERT_ATTRIB_GENERIC(index),
legalTypes, 1, BGRA_OR_4,
size, type, stride, normalized, GL_FALSE, ptr);
}
return;
}
- update_array(ctx, "glVertexAttribIPointer",
- &ctx->Array.ArrayObj->VertexAttrib[index],
- VERT_BIT_GENERIC(index),
+ update_array(ctx, "glVertexAttribIPointer", VERT_ATTRIB_GENERIC(index),
legalTypes, 1, 4,
size, type, stride, normalized, integer, ptr);
}
return;
}
- ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
+ ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->VertexAttrib));
FLUSH_VERTICES(ctx, _NEW_ARRAY);
- ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_TRUE;
+ ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE;
ctx->Array.ArrayObj->_Enabled |= VERT_BIT_GENERIC(index);
ctx->Array.NewState |= VERT_BIT_GENERIC(index);
}
return;
}
- ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
+ ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->VertexAttrib));
FLUSH_VERTICES(ctx, _NEW_ARRAY);
- ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_FALSE;
+ ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE;
ctx->Array.ArrayObj->_Enabled &= ~VERT_BIT_GENERIC(index);
ctx->Array.NewState |= VERT_BIT_GENERIC(index);
}
return 0;
}
- ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
+ ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->VertexAttrib));
- array = &ctx->Array.ArrayObj->VertexAttrib[index];
+ array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)];
switch (pname) {
case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
return NULL;
}
+ ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->VertexAttrib));
+
FLUSH_CURRENT(ctx, 0);
- return ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index];
+ return ctx->Current.Attrib[VERT_ATTRIB_GENERIC(index)];
}
void GLAPIENTRY
return;
}
- ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib));
+ ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->VertexAttrib));
- *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr;
+ *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Ptr;
}
return;
}
- ctx->Array.ArrayObj->VertexAttrib[index].InstanceDivisor = divisor;
+ ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->VertexAttrib));
+
+ ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].InstanceDivisor = divisor;
}
_mesa_update_array_object_max_element(ctx, arrayObj);
printf("Array Object %u\n", arrayObj->Name);
- if (arrayObj->Vertex.Enabled)
- print_array("Vertex", -1, &arrayObj->Vertex);
- if (arrayObj->Normal.Enabled)
- print_array("Normal", -1, &arrayObj->Normal);
- if (arrayObj->Color.Enabled)
- print_array("Color", -1, &arrayObj->Color);
- for (i = 0; i < Elements(arrayObj->TexCoord); i++)
- if (arrayObj->TexCoord[i].Enabled)
- print_array("TexCoord", i, &arrayObj->TexCoord[i]);
- for (i = 0; i < Elements(arrayObj->VertexAttrib); i++)
- if (arrayObj->VertexAttrib[i].Enabled)
- print_array("Attrib", i, &arrayObj->VertexAttrib[i]);
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled)
+ print_array("Vertex", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]);
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled)
+ print_array("Normal", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]);
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled)
+ print_array("Color", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]);
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++)
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)].Enabled)
+ print_array("TexCoord", i, &arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)]);
+ for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++)
+ if (arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled)
+ print_array("Attrib", i, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)]);
printf(" _MaxElement = %u\n", arrayObj->_MaxElement);
}
VBO_ATTRIB_TEX5 = 13,
VBO_ATTRIB_TEX6 = 14,
VBO_ATTRIB_TEX7 = 15,
+ VBO_ATTRIB_POINT_SIZE = 16,
- VBO_ATTRIB_GENERIC0 = 16, /* Not used? */
- VBO_ATTRIB_GENERIC1 = 17,
- VBO_ATTRIB_GENERIC2 = 18,
- VBO_ATTRIB_GENERIC3 = 19,
- VBO_ATTRIB_GENERIC4 = 20,
- VBO_ATTRIB_GENERIC5 = 21,
- VBO_ATTRIB_GENERIC6 = 22,
- VBO_ATTRIB_GENERIC7 = 23,
- VBO_ATTRIB_GENERIC8 = 24,
- VBO_ATTRIB_GENERIC9 = 25,
- VBO_ATTRIB_GENERIC10 = 26,
- VBO_ATTRIB_GENERIC11 = 27,
- VBO_ATTRIB_GENERIC12 = 28,
- VBO_ATTRIB_GENERIC13 = 29,
- VBO_ATTRIB_GENERIC14 = 30,
- VBO_ATTRIB_GENERIC15 = 31,
+ VBO_ATTRIB_GENERIC0 = 17, /* Not used? */
+ VBO_ATTRIB_GENERIC1 = 18,
+ VBO_ATTRIB_GENERIC2 = 19,
+ VBO_ATTRIB_GENERIC3 = 20,
+ VBO_ATTRIB_GENERIC4 = 21,
+ VBO_ATTRIB_GENERIC5 = 22,
+ VBO_ATTRIB_GENERIC6 = 23,
+ VBO_ATTRIB_GENERIC7 = 24,
+ VBO_ATTRIB_GENERIC8 = 25,
+ VBO_ATTRIB_GENERIC9 = 26,
+ VBO_ATTRIB_GENERIC10 = 27,
+ VBO_ATTRIB_GENERIC11 = 28,
+ VBO_ATTRIB_GENERIC12 = 29,
+ VBO_ATTRIB_GENERIC13 = 30,
+ VBO_ATTRIB_GENERIC14 = 31,
+ VBO_ATTRIB_GENERIC15 = 32,
/* XXX: in the vertex program InputsRead flag, we alias
* materials and generics and use knowledge about the program
* (whether it is a fixed-function emulation) to
* differentiate. Here we must keep them apart instead.
*/
- VBO_ATTRIB_MAT_FRONT_AMBIENT = 32,
- VBO_ATTRIB_MAT_BACK_AMBIENT = 33,
- VBO_ATTRIB_MAT_FRONT_DIFFUSE = 34,
- VBO_ATTRIB_MAT_BACK_DIFFUSE = 35,
- VBO_ATTRIB_MAT_FRONT_SPECULAR = 36,
- VBO_ATTRIB_MAT_BACK_SPECULAR = 37,
- VBO_ATTRIB_MAT_FRONT_EMISSION = 38,
- VBO_ATTRIB_MAT_BACK_EMISSION = 39,
- VBO_ATTRIB_MAT_FRONT_SHININESS = 40,
- VBO_ATTRIB_MAT_BACK_SHININESS = 41,
- VBO_ATTRIB_MAT_FRONT_INDEXES = 42,
- VBO_ATTRIB_MAT_BACK_INDEXES = 43,
+ VBO_ATTRIB_MAT_FRONT_AMBIENT = 33,
+ VBO_ATTRIB_MAT_BACK_AMBIENT = 34,
+ VBO_ATTRIB_MAT_FRONT_DIFFUSE = 35,
+ VBO_ATTRIB_MAT_BACK_DIFFUSE = 36,
+ VBO_ATTRIB_MAT_FRONT_SPECULAR = 37,
+ VBO_ATTRIB_MAT_BACK_SPECULAR = 38,
+ VBO_ATTRIB_MAT_FRONT_EMISSION = 39,
+ VBO_ATTRIB_MAT_BACK_EMISSION = 40,
+ VBO_ATTRIB_MAT_FRONT_SHININESS = 41,
+ VBO_ATTRIB_MAT_BACK_SHININESS = 42,
+ VBO_ATTRIB_MAT_FRONT_INDEXES = 43,
+ VBO_ATTRIB_MAT_BACK_INDEXES = 44,
- VBO_ATTRIB_MAX = 44
+ VBO_ATTRIB_MAX = 45
};
#define VBO_ATTRIB_FIRST_MATERIAL VBO_ATTRIB_MAT_FRONT_AMBIENT
}
/* check element j of each enabled array */
- check_array_data(ctx, &arrayObj->Vertex, VERT_ATTRIB_POS, j);
- check_array_data(ctx, &arrayObj->Normal, VERT_ATTRIB_NORMAL, j);
- check_array_data(ctx, &arrayObj->Color, VERT_ATTRIB_COLOR0, j);
- check_array_data(ctx, &arrayObj->SecondaryColor, VERT_ATTRIB_COLOR1, j);
- for (k = 0; k < Elements(arrayObj->TexCoord); k++) {
- check_array_data(ctx, &arrayObj->TexCoord[k], VERT_ATTRIB_TEX0 + k, j);
- }
for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) {
- check_array_data(ctx, &arrayObj->VertexAttrib[k],
- VERT_ATTRIB_GENERIC0 + k, j);
+ check_array_data(ctx, &arrayObj->VertexAttrib[k], k, j);
}
}
ctx->Driver.UnmapBuffer(ctx, ctx->Array.ArrayObj->ElementArrayBufferObj);
}
- unmap_array_buffer(ctx, &arrayObj->Vertex);
- unmap_array_buffer(ctx, &arrayObj->Normal);
- unmap_array_buffer(ctx, &arrayObj->Color);
- for (k = 0; k < Elements(arrayObj->TexCoord); k++) {
- unmap_array_buffer(ctx, &arrayObj->TexCoord[k]);
- }
for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) {
unmap_array_buffer(ctx, &arrayObj->VertexAttrib[k]);
}
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
GLuint i;
- /* TODO: Fix the ArrayObj struct to keep legacy arrays in an array
- * rather than as individual named arrays. Then this function can
- * go away.
- */
- exec->array.legacy_array[VERT_ATTRIB_POS] = &arrayObj->Vertex;
- exec->array.legacy_array[VERT_ATTRIB_WEIGHT] = &arrayObj->Weight;
- exec->array.legacy_array[VERT_ATTRIB_NORMAL] = &arrayObj->Normal;
- exec->array.legacy_array[VERT_ATTRIB_COLOR0] = &arrayObj->Color;
- exec->array.legacy_array[VERT_ATTRIB_COLOR1] = &arrayObj->SecondaryColor;
- exec->array.legacy_array[VERT_ATTRIB_FOG] = &arrayObj->FogCoord;
- exec->array.legacy_array[VERT_ATTRIB_COLOR_INDEX] = &arrayObj->Index;
- if (arrayObj->PointSize.Enabled) {
- /* this aliases COLOR_INDEX */
- exec->array.legacy_array[VERT_ATTRIB_POINT_SIZE] = &arrayObj->PointSize;
- }
- exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &arrayObj->EdgeFlag;
-
- for (i = 0; i < Elements(arrayObj->TexCoord); i++)
- exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &arrayObj->TexCoord[i];
+ for (i = 0; i < VERT_ATTRIB_FF_MAX; i++)
+ exec->array.legacy_array[i] = &arrayObj->VertexAttrib[VERT_ATTRIB_FF(i)];
- for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) {
+ for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
assert(i < Elements(exec->array.generic_array));
- exec->array.generic_array[i] = &arrayObj->VertexAttrib[i];
+ exec->array.generic_array[i] = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)];
}
}