mesa/vbo: replace Elements() with ARRAY_SIZE()
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
parent
c2e130f820
commit
766f5cf8f8
|
@ -172,14 +172,14 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx )
|
|||
GLuint i;
|
||||
|
||||
/* identity mapping */
|
||||
for (i = 0; i < Elements(vbo->map_vp_none); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(vbo->map_vp_none); i++)
|
||||
vbo->map_vp_none[i] = i;
|
||||
/* map material attribs to generic slots */
|
||||
for (i = 0; i < NR_MAT_ATTRIBS; i++)
|
||||
vbo->map_vp_none[VERT_ATTRIB_GENERIC(i)]
|
||||
= VBO_ATTRIB_MAT_FRONT_AMBIENT + i;
|
||||
|
||||
for (i = 0; i < Elements(vbo->map_vp_arb); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(vbo->map_vp_arb); i++)
|
||||
vbo->map_vp_arb[i] = i;
|
||||
}
|
||||
|
||||
|
|
|
@ -1044,16 +1044,16 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
|
|||
_mesa_noop_vtxfmt_init(&exec->vtxfmt_noop);
|
||||
|
||||
for (i = 0 ; i < VBO_ATTRIB_MAX ; i++) {
|
||||
assert(i < Elements(exec->vtx.attrsz));
|
||||
assert(i < ARRAY_SIZE(exec->vtx.attrsz));
|
||||
exec->vtx.attrsz[i] = 0;
|
||||
assert(i < Elements(exec->vtx.attrtype));
|
||||
assert(i < ARRAY_SIZE(exec->vtx.attrtype));
|
||||
exec->vtx.attrtype[i] = GL_FLOAT;
|
||||
assert(i < Elements(exec->vtx.active_sz));
|
||||
assert(i < ARRAY_SIZE(exec->vtx.active_sz));
|
||||
exec->vtx.active_sz[i] = 0;
|
||||
}
|
||||
for (i = 0 ; i < VERT_ATTRIB_MAX; i++) {
|
||||
assert(i < Elements(exec->vtx.inputs));
|
||||
assert(i < Elements(exec->vtx.arrays));
|
||||
assert(i < ARRAY_SIZE(exec->vtx.inputs));
|
||||
assert(i < ARRAY_SIZE(exec->vtx.arrays));
|
||||
exec->vtx.inputs[i] = &exec->vtx.arrays[i];
|
||||
}
|
||||
|
||||
|
@ -1110,7 +1110,7 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
|
|||
|
||||
/* Drop any outstanding reference to the vertex buffer
|
||||
*/
|
||||
for (i = 0; i < Elements(exec->vtx.arrays); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(exec->vtx.arrays); i++) {
|
||||
_mesa_reference_buffer_object(ctx,
|
||||
&exec->vtx.arrays[i].BufferObj,
|
||||
NULL);
|
||||
|
|
|
@ -330,7 +330,7 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
|
|||
}
|
||||
|
||||
/* check element j of each enabled array */
|
||||
for (k = 0; k < Elements(vao->_VertexAttrib); k++) {
|
||||
for (k = 0; k < ARRAY_SIZE(vao->_VertexAttrib); k++) {
|
||||
check_array_data(ctx, &vao->_VertexAttrib[k], k, j);
|
||||
}
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
|
|||
MAP_INTERNAL);
|
||||
}
|
||||
|
||||
for (k = 0; k < Elements(vao->_VertexAttrib); k++) {
|
||||
for (k = 0; k < ARRAY_SIZE(vao->_VertexAttrib); k++) {
|
||||
unmap_array_buffer(ctx, &vao->_VertexAttrib[k]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
|
|||
exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
|
||||
}
|
||||
for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
|
||||
assert(VERT_ATTRIB_GENERIC(attr) < Elements(exec->vtx.inputs));
|
||||
assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs));
|
||||
exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
|
||||
&vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr];
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
|
|||
exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
|
||||
}
|
||||
for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
|
||||
assert(VERT_ATTRIB_GENERIC(attr) < Elements(exec->vtx.inputs));
|
||||
assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs));
|
||||
exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
|
||||
&vbo->currval[VBO_ATTRIB_GENERIC0+attr];
|
||||
}
|
||||
|
@ -213,8 +213,8 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
|
|||
(GLbyte *)exec->vtx.vertex;
|
||||
|
||||
/* override the default array set above */
|
||||
assert(attr < Elements(exec->vtx.inputs));
|
||||
assert(attr < Elements(exec->vtx.arrays)); /* arrays[] */
|
||||
assert(attr < ARRAY_SIZE(exec->vtx.inputs));
|
||||
assert(attr < ARRAY_SIZE(exec->vtx.arrays)); /* arrays[] */
|
||||
exec->vtx.inputs[attr] = &arrays[attr];
|
||||
|
||||
if (_mesa_is_bufferobj(exec->vtx.bufferobj)) {
|
||||
|
|
|
@ -35,20 +35,20 @@
|
|||
|
||||
static void clear_active_eval1( struct vbo_exec_context *exec, GLuint attr )
|
||||
{
|
||||
assert(attr < Elements(exec->eval.map1));
|
||||
assert(attr < ARRAY_SIZE(exec->eval.map1));
|
||||
exec->eval.map1[attr].map = NULL;
|
||||
}
|
||||
|
||||
static void clear_active_eval2( struct vbo_exec_context *exec, GLuint attr )
|
||||
{
|
||||
assert(attr < Elements(exec->eval.map2));
|
||||
assert(attr < ARRAY_SIZE(exec->eval.map2));
|
||||
exec->eval.map2[attr].map = NULL;
|
||||
}
|
||||
|
||||
static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint dim,
|
||||
struct gl_1d_map *map )
|
||||
{
|
||||
assert(attr < Elements(exec->eval.map1));
|
||||
assert(attr < ARRAY_SIZE(exec->eval.map1));
|
||||
if (!exec->eval.map1[attr].map) {
|
||||
exec->eval.map1[attr].map = map;
|
||||
exec->eval.map1[attr].sz = dim;
|
||||
|
@ -58,7 +58,7 @@ static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint
|
|||
static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint dim,
|
||||
struct gl_2d_map *map )
|
||||
{
|
||||
assert(attr < Elements(exec->eval.map2));
|
||||
assert(attr < ARRAY_SIZE(exec->eval.map2));
|
||||
if (!exec->eval.map2[attr].map) {
|
||||
exec->eval.map2[attr].map = map;
|
||||
exec->eval.map2[attr].sz = dim;
|
||||
|
|
Loading…
Reference in New Issue