aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2011-10-31 22:23:51 +0100
committerMathias Fröhlich <[email protected]>2011-11-29 06:37:19 +0100
commit762c9766c93697af8d7fbaa729aed118789dbe8e (patch)
treecff8bf8eaa64b2a47226c9f02f0e5e85c42949d0 /src/mesa/vbo
parentdca6a28a14f22d77273d79d44f57b0d853c0242d (diff)
mesa: Use VERT_ATTRIB_* indexed array in gl_array_object.
Replace the distinct struct gl_client_array members in gl_array_object by an array of gl_client_arrays indexed by VERT_ATTRIB_*. Renumber the vertex attributes slightly to keep the old semantics of the distinct array members. Make use of the upper 32 bits in VERT_BIT_*. Update all occurances of the distinct struct members with the array equivalents. Signed-off-by: Mathias Froehlich <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r--src/mesa/vbo/vbo_attrib.h59
-rw-r--r--src/mesa/vbo/vbo_exec_array.c41
2 files changed, 35 insertions, 65 deletions
diff --git a/src/mesa/vbo/vbo_attrib.h b/src/mesa/vbo/vbo_attrib.h
index 0ae928f2af4..c2f4e6ec889 100644
--- a/src/mesa/vbo/vbo_attrib.h
+++ b/src/mesa/vbo/vbo_attrib.h
@@ -60,43 +60,44 @@ enum {
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
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index fa45a202eee..97221a54d44 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -297,16 +297,8 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
}
/* 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);
}
}
@@ -314,12 +306,6 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
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]);
}
@@ -398,29 +384,12 @@ bind_array_obj(struct gl_context *ctx)
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)];
}
}