From 766f5cf8f88c08a7673beb492095ad8ca878bc22 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 28 Feb 2015 08:57:15 -0700 Subject: [PATCH] mesa/vbo: replace Elements() with ARRAY_SIZE() Acked-by: Ilia Mirkin --- src/mesa/vbo/vbo_context.c | 4 ++-- src/mesa/vbo/vbo_exec_api.c | 12 ++++++------ src/mesa/vbo/vbo_exec_array.c | 4 ++-- src/mesa/vbo/vbo_exec_draw.c | 8 ++++---- src/mesa/vbo/vbo_exec_eval.c | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 696a6fa1f17..fd1ffe2f76d 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -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; } diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 2a17ff54110..9669abe7d42 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -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); diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index b547e4e1dd9..8a366180b32 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -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]); } } diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index ec44fdb975d..fa5eba9212f 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -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)) { diff --git a/src/mesa/vbo/vbo_exec_eval.c b/src/mesa/vbo/vbo_exec_eval.c index 409f31abf88..b26655bd51a 100644 --- a/src/mesa/vbo/vbo_exec_eval.c +++ b/src/mesa/vbo/vbo_exec_eval.c @@ -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; -- 2.30.2