diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/arrayobj.c | 6 | ||||
-rw-r--r-- | src/mesa/main/attrib.c | 2 | ||||
-rw-r--r-- | src/mesa/main/blend.c | 2 | ||||
-rw-r--r-- | src/mesa/main/blit.c | 2 | ||||
-rw-r--r-- | src/mesa/main/bufferobj.c | 2 | ||||
-rw-r--r-- | src/mesa/main/context.c | 2 | ||||
-rw-r--r-- | src/mesa/main/debug.c | 8 | ||||
-rw-r--r-- | src/mesa/main/errors.c | 6 | ||||
-rw-r--r-- | src/mesa/main/es1_conversion.c | 16 | ||||
-rw-r--r-- | src/mesa/main/formats.c | 2 | ||||
-rw-r--r-- | src/mesa/main/get.c | 14 | ||||
-rw-r--r-- | src/mesa/main/matrix.c | 10 | ||||
-rw-r--r-- | src/mesa/main/points.c | 2 | ||||
-rw-r--r-- | src/mesa/main/rastpos.c | 4 | ||||
-rw-r--r-- | src/mesa/main/remap.c | 2 | ||||
-rw-r--r-- | src/mesa/main/shared.c | 2 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 4 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 16 | ||||
-rw-r--r-- | src/mesa/main/texstate.h | 2 | ||||
-rw-r--r-- | src/mesa/main/texstorage.c | 2 | ||||
-rw-r--r-- | src/mesa/main/transformfeedback.c | 2 | ||||
-rw-r--r-- | src/mesa/main/uniform_query.cpp | 2 | ||||
-rw-r--r-- | src/mesa/main/uniforms.c | 2 | ||||
-rw-r--r-- | src/mesa/main/varray.c | 14 |
24 files changed, 63 insertions, 63 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index bdbd169ef9f..3c8ffb5a422 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -84,10 +84,10 @@ unbind_array_object_vbos(struct gl_context *ctx, struct gl_vertex_array_object * { GLuint i; - for (i = 0; i < Elements(obj->VertexBinding); i++) + for (i = 0; i < ARRAY_SIZE(obj->VertexBinding); i++) _mesa_reference_buffer_object(ctx, &obj->VertexBinding[i].BufferObj, NULL); - for (i = 0; i < Elements(obj->_VertexAttrib); i++) + for (i = 0; i < ARRAY_SIZE(obj->_VertexAttrib); i++) _mesa_reference_buffer_object(ctx, &obj->_VertexAttrib[i].BufferObj, NULL); } @@ -230,7 +230,7 @@ _mesa_initialize_vao(struct gl_context *ctx, obj->RefCount = 1; /* Init the individual arrays */ - for (i = 0; i < Elements(obj->VertexAttrib); i++) { + for (i = 0; i < ARRAY_SIZE(obj->VertexAttrib); i++) { switch (i) { case VERT_ATTRIB_WEIGHT: init_array(ctx, obj, VERT_ATTRIB_WEIGHT, 1, GL_FLOAT); diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 07934b9bca0..20216a87d20 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1453,7 +1453,7 @@ copy_array_object(struct gl_context *ctx, /* In theory must be the same anyway, but on recreate make sure it matches */ dest->ARBsemantics = src->ARBsemantics; - for (i = 0; i < Elements(src->VertexAttrib); i++) { + for (i = 0; i < ARRAY_SIZE(src->VertexAttrib); i++) { _mesa_copy_client_array(ctx, &dest->_VertexAttrib[i], &src->_VertexAttrib[i]); _mesa_copy_vertex_attrib_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]); _mesa_copy_vertex_buffer_binding(ctx, &dest->VertexBinding[i], &src->VertexBinding[i]); diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index b941937d82d..774fc888ec4 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -896,7 +896,7 @@ void _mesa_init_color( struct gl_context * ctx ) ctx->Color.AlphaFunc = GL_ALWAYS; ctx->Color.AlphaRef = 0; ctx->Color.BlendEnabled = 0x0; - for (i = 0; i < Elements(ctx->Color.Blend); i++) { + for (i = 0; i < ARRAY_SIZE(ctx->Color.Blend); i++) { ctx->Color.Blend[i].SrcRGB = GL_ONE; ctx->Color.Blend[i].DstRGB = GL_ZERO; ctx->Color.Blend[i].SrcA = GL_ONE; diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c index b244c8de846..28987232140 100644 --- a/src/mesa/main/blit.c +++ b/src/mesa/main/blit.c @@ -48,7 +48,7 @@ find_attachment(const struct gl_framebuffer *fb, const struct gl_renderbuffer *rb) { GLuint i; - for (i = 0; i < Elements(fb->Attachment); i++) { + for (i = 0; i < ARRAY_SIZE(fb->Attachment); i++) { if (fb->Attachment[i].Renderbuffer == rb) return &fb->Attachment[i]; } diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index f026fc39341..e1c5877797a 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1179,7 +1179,7 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids) _mesa_buffer_unmap_all_mappings(ctx, bufObj); /* unbind any vertex pointers bound to this buffer */ - for (j = 0; j < Elements(vao->VertexBinding); j++) { + for (j = 0; j < ARRAY_SIZE(vao->VertexBinding); j++) { unbind(ctx, &vao->VertexBinding[j].BufferObj, bufObj); } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index d6c13680f24..22c2341d64f 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -447,7 +447,7 @@ _mesa_init_current(struct gl_context *ctx) GLuint i; /* Init all to (0,0,0,1) */ - for (i = 0; i < Elements(ctx->Current.Attrib); i++) { + for (i = 0; i < ARRAY_SIZE(ctx->Current.Attrib); i++) { ASSIGN_4V( ctx->Current.Attrib[i], 0.0, 0.0, 0.0, 1.0 ); } diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 089ce8987ae..45221145015 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -58,8 +58,8 @@ tex_target_name(GLenum tgt) { GL_TEXTURE_EXTERNAL_OES, "GL_TEXTURE_EXTERNAL_OES" } }; GLuint i; - STATIC_ASSERT(Elements(tex_targets) == NUM_TEXTURE_TARGETS); - for (i = 0; i < Elements(tex_targets); i++) { + STATIC_ASSERT(ARRAY_SIZE(tex_targets) == NUM_TEXTURE_TARGETS); + for (i = 0; i < ARRAY_SIZE(tex_targets); i++) { if (tex_targets[i].target == tgt) return tex_targets[i].name; } @@ -168,7 +168,7 @@ set_verbose_flags(const char *str) return; MESA_VERBOSE = 0x0; - for (i = 0; i < Elements(opts); i++) { + for (i = 0; i < ARRAY_SIZE(opts); i++) { if (strstr(str, opts[i].name) || strcmp(str, "all") == 0) MESA_VERBOSE |= opts[i].flag; } @@ -201,7 +201,7 @@ set_debug_flags(const char *str) return; MESA_DEBUG_FLAGS = 0x0; - for (i = 0; i < Elements(opts); i++) { + for (i = 0; i < ARRAY_SIZE(opts); i++) { if (strstr(str, opts[i].name)) MESA_DEBUG_FLAGS |= opts[i].flag; } diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index 43e8adfc1c0..33c17308a4d 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -137,7 +137,7 @@ gl_enum_to_debug_source(GLenum e) { unsigned i; - for (i = 0; i < Elements(debug_source_enums); i++) { + for (i = 0; i < ARRAY_SIZE(debug_source_enums); i++) { if (debug_source_enums[i] == e) break; } @@ -149,7 +149,7 @@ gl_enum_to_debug_type(GLenum e) { unsigned i; - for (i = 0; i < Elements(debug_type_enums); i++) { + for (i = 0; i < ARRAY_SIZE(debug_type_enums); i++) { if (debug_type_enums[i] == e) break; } @@ -161,7 +161,7 @@ gl_enum_to_debug_severity(GLenum e) { unsigned i; - for (i = 0; i < Elements(debug_severity_enums); i++) { + for (i = 0; i < ARRAY_SIZE(debug_severity_enums); i++) { if (debug_severity_enums[i] == e) break; } diff --git a/src/mesa/main/es1_conversion.c b/src/mesa/main/es1_conversion.c index 60a60e287d9..b254a6ef1c7 100644 --- a/src/mesa/main/es1_conversion.c +++ b/src/mesa/main/es1_conversion.c @@ -55,7 +55,7 @@ _mesa_ClipPlanef(GLenum plane, const GLfloat *equation) unsigned int i; GLdouble converted_equation[4]; - for (i = 0; i < Elements(converted_equation); i++) { + for (i = 0; i < ARRAY_SIZE(converted_equation); i++) { converted_equation[i] = (GLdouble) (equation[i]); } @@ -68,7 +68,7 @@ _mesa_ClipPlanex(GLenum plane, const GLfixed *equation) unsigned int i; GLdouble converted_equation[4]; - for (i = 0; i < Elements(converted_equation); i++) { + for (i = 0; i < ARRAY_SIZE(converted_equation); i++) { converted_equation[i] = (GLdouble) (equation[i] / 65536.0); } @@ -117,7 +117,7 @@ _mesa_DrawTexxvOES(const GLfixed *coords) unsigned int i; GLfloat converted_coords[5]; - for (i = 0; i < Elements(converted_coords); i++) { + for (i = 0; i < ARRAY_SIZE(converted_coords); i++) { converted_coords[i] = (GLfloat) (coords[i] / 65536.0f); } @@ -206,7 +206,7 @@ _mesa_GetClipPlanef(GLenum plane, GLfloat *equation) GLdouble converted_equation[4]; _mesa_GetClipPlane(plane, converted_equation); - for (i = 0; i < Elements(converted_equation); i++) { + for (i = 0; i < ARRAY_SIZE(converted_equation); i++) { equation[i] = (GLfloat) (converted_equation[i]); } } @@ -218,7 +218,7 @@ _mesa_GetClipPlanex(GLenum plane, GLfixed *equation) GLdouble converted_equation[4]; _mesa_GetClipPlane(plane, converted_equation); - for (i = 0; i < Elements(converted_equation); i++) { + for (i = 0; i < ARRAY_SIZE(converted_equation); i++) { equation[i] = (GLfixed) (converted_equation[i] * 65536); } } @@ -549,7 +549,7 @@ _mesa_LoadMatrixx(const GLfixed *m) unsigned int i; GLfloat converted_m[16]; - for (i = 0; i < Elements(converted_m); i++) { + for (i = 0; i < ARRAY_SIZE(converted_m); i++) { converted_m[i] = (GLfloat) (m[i] / 65536.0f); } @@ -617,7 +617,7 @@ _mesa_MultMatrixx(const GLfixed *m) unsigned int i; GLfloat converted_m[16]; - for (i = 0; i < Elements(converted_m); i++) { + for (i = 0; i < ARRAY_SIZE(converted_m); i++) { converted_m[i] = (GLfloat) (m[i] / 65536.0f); } @@ -825,7 +825,7 @@ _mesa_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params) unsigned int i; GLfloat converted_params[4]; - for (i = 0; i < Elements(converted_params); i++) { + for (i = 0; i < ARRAY_SIZE(converted_params); i++) { converted_params[i] = (GLfloat) (params[i] / 65536.0f); } diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index df852f303e5..a6f5cde0c57 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -887,7 +887,7 @@ _mesa_test_formats(void) { GLuint i; - STATIC_ASSERT(Elements(format_info) == MESA_FORMAT_COUNT); + STATIC_ASSERT(ARRAY_SIZE(format_info) == MESA_FORMAT_COUNT); for (i = 0; i < MESA_FORMAT_COUNT; i++) { const struct gl_format_info *info = _mesa_get_format_info(i); diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 2f4693ad6a0..a881bc589ba 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -497,12 +497,12 @@ print_table_stats(int api) }; const char *api_name; - api_name = api < Elements(api_names) ? api_names[api] : "N/A"; + api_name = api < ARRAY_SIZE(api_names) ? api_names[api] : "N/A"; count = 0; - mask = Elements(table(api)) - 1; + mask = ARRAY_SIZE(table(api)) - 1; memset(collisions, 0, sizeof collisions); - for (i = 0; i < Elements(table(api)); i++) { + for (i = 0; i < ARRAY_SIZE(table(api)); i++) { if (!table(api)[i]) continue; count++; @@ -523,8 +523,8 @@ print_table_stats(int api) } printf("number of enums for %s: %d (total %ld)\n", - api_name, count, Elements(values)); - for (i = 0; i < Elements(collisions) - 1; i++) + api_name, count, ARRAY_SIZE(values)); + for (i = 0; i < ARRAY_SIZE(collisions) - 1; i++) if (collisions[i] > 0) printf(" %d enums with %d %scollisions\n", collisions[i], i, i == 10 ? "or more " : ""); @@ -1195,11 +1195,11 @@ find_value(const char *func, GLenum pname, void **p, union value *v) * value since it's compatible with GLES2 its entry in table_set[] is at the * end. */ - STATIC_ASSERT(Elements(table_set) == API_OPENGL_LAST + 2); + STATIC_ASSERT(ARRAY_SIZE(table_set) == API_OPENGL_LAST + 2); if (_mesa_is_gles3(ctx)) { api = API_OPENGL_LAST + 1; } - mask = Elements(table(api)) - 1; + mask = ARRAY_SIZE(table(api)) - 1; hash = (pname * prime_factor); while (1) { int idx = table(api)[hash & mask]; diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 4a2ce751aa5..80c8a248ce4 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -176,7 +176,7 @@ _mesa_MatrixMode( GLenum mode ) return; } #endif - assert(ctx->Texture.CurrentUnit < Elements(ctx->TextureMatrixStack)); + assert(ctx->Texture.CurrentUnit < ARRAY_SIZE(ctx->TextureMatrixStack)); ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit]; break; case GL_MATRIX0_ARB: @@ -697,10 +697,10 @@ void _mesa_init_matrix( struct gl_context * ctx ) _NEW_MODELVIEW); init_matrix_stack(&ctx->ProjectionMatrixStack, MAX_PROJECTION_STACK_DEPTH, _NEW_PROJECTION); - for (i = 0; i < Elements(ctx->TextureMatrixStack); i++) + for (i = 0; i < ARRAY_SIZE(ctx->TextureMatrixStack); i++) init_matrix_stack(&ctx->TextureMatrixStack[i], MAX_TEXTURE_STACK_DEPTH, _NEW_TEXTURE_MATRIX); - for (i = 0; i < Elements(ctx->ProgramMatrixStack); i++) + for (i = 0; i < ARRAY_SIZE(ctx->ProgramMatrixStack); i++) init_matrix_stack(&ctx->ProgramMatrixStack[i], MAX_PROGRAM_MATRIX_STACK_DEPTH, _NEW_TRACK_MATRIX); ctx->CurrentStack = &ctx->ModelviewMatrixStack; @@ -724,9 +724,9 @@ void _mesa_free_matrix_data( struct gl_context *ctx ) free_matrix_stack(&ctx->ModelviewMatrixStack); free_matrix_stack(&ctx->ProjectionMatrixStack); - for (i = 0; i < Elements(ctx->TextureMatrixStack); i++) + for (i = 0; i < ARRAY_SIZE(ctx->TextureMatrixStack); i++) free_matrix_stack(&ctx->TextureMatrixStack[i]); - for (i = 0; i < Elements(ctx->ProgramMatrixStack); i++) + for (i = 0; i < ARRAY_SIZE(ctx->ProgramMatrixStack); i++) free_matrix_stack(&ctx->ProgramMatrixStack[i]); /* combined Modelview*Projection matrix */ _math_matrix_dtr( &ctx->_ModelProjectMatrix ); diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index 0a7807d77ac..5ad1f38f366 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -253,7 +253,7 @@ _mesa_init_point(struct gl_context *ctx) ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */ ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */ - for (i = 0; i < Elements(ctx->Point.CoordReplace); i++) { + for (i = 0; i < ARRAY_SIZE(ctx->Point.CoordReplace); i++) { ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */ } } diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 2027a9bd023..54b2125a80f 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -266,7 +266,7 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z) { GLuint texSet; for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) { - assert(texSet < Elements(ctx->Current.RasterTexCoords)); + assert(texSet < ARRAY_SIZE(ctx->Current.RasterTexCoords)); COPY_4FV( ctx->Current.RasterTexCoords[texSet], ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); } @@ -496,7 +496,7 @@ void _mesa_init_rastpos( struct gl_context * ctx ) ctx->Current.RasterDistance = 0.0; ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 ); ASSIGN_4V( ctx->Current.RasterSecondaryColor, 0.0, 0.0, 0.0, 1.0 ); - for (i = 0; i < Elements(ctx->Current.RasterTexCoords); i++) + for (i = 0; i < ARRAY_SIZE(ctx->Current.RasterTexCoords); i++) ASSIGN_4V( ctx->Current.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 ); ctx->Current.RasterPosValid = GL_TRUE; } diff --git a/src/mesa/main/remap.c b/src/mesa/main/remap.c index 01f7594dc49..5a953877285 100644 --- a/src/mesa/main/remap.c +++ b/src/mesa/main/remap.c @@ -60,7 +60,7 @@ int driDispatchRemapTable[driDispatchRemapTable_size]; const char * _mesa_get_function_spec(GLint func_index) { - if (func_index < Elements(_mesa_function_pool)) + if (func_index < ARRAY_SIZE(_mesa_function_pool)) return _mesa_function_pool + func_index; else return NULL; diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index 7162bbc761e..0b76cc01218 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -105,7 +105,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx) GL_TEXTURE_2D, GL_TEXTURE_1D }; - STATIC_ASSERT(Elements(targets) == NUM_TEXTURE_TARGETS); + STATIC_ASSERT(ARRAY_SIZE(targets) == NUM_TEXTURE_TARGETS); shared->DefaultTex[i] = ctx->Driver.NewTextureObject(ctx, 0, targets[i]); } diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 6e45cc927cc..5ea48c5e549 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -729,9 +729,9 @@ _mesa_is_proxy_texture(GLenum target) * NUM_TEXTURE_TARGETS should match number of terms above, except there's no * proxy for GL_TEXTURE_BUFFER and GL_TEXTURE_EXTERNAL_OES. */ - STATIC_ASSERT(NUM_TEXTURE_TARGETS == Elements(targets) + 2); + STATIC_ASSERT(NUM_TEXTURE_TARGETS == ARRAY_SIZE(targets) + 2); - for (i = 0; i < Elements(targets); ++i) + for (i = 0; i < ARRAY_SIZE(targets); ++i) if (target == targets[i]) return GL_TRUE; return GL_FALSE; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 8b5853d1e94..78ae7d235d6 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -292,7 +292,7 @@ _mesa_ActiveTexture(GLenum texture) k = _mesa_max_tex_unit(ctx); - assert(k <= Elements(ctx->Texture.Unit)); + assert(k <= ARRAY_SIZE(ctx->Texture.Unit)); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glActiveTexture %s\n", @@ -363,7 +363,7 @@ update_texture_matrices( struct gl_context *ctx ) ctx->Texture._TexMatEnabled = 0x0; for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { - assert(u < Elements(ctx->TextureMatrixStack)); + assert(u < ARRAY_SIZE(ctx->TextureMatrixStack)); if (_math_matrix_is_dirty(ctx->TextureMatrixStack[u].Top)) { _math_matrix_analyse( ctx->TextureMatrixStack[u].Top ); @@ -501,7 +501,7 @@ update_texgen(struct gl_context *ctx) ctx->Texture._GenFlags |= texUnit->_GenFlags; } - assert(unit < Elements(ctx->TextureMatrixStack)); + assert(unit < ARRAY_SIZE(ctx->TextureMatrixStack)); if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); } @@ -797,7 +797,7 @@ alloc_proxy_textures( struct gl_context *ctx ) }; GLint tgt; - STATIC_ASSERT(Elements(targets) == NUM_TEXTURE_TARGETS); + STATIC_ASSERT(ARRAY_SIZE(targets) == NUM_TEXTURE_TARGETS); assert(targets[TEXTURE_2D_INDEX] == GL_TEXTURE_2D); assert(targets[TEXTURE_CUBE_INDEX] == GL_TEXTURE_CUBE_MAP); @@ -894,7 +894,7 @@ _mesa_init_texture(struct gl_context *ctx) */ ctx->Texture.CubeMapSeamless = ctx->API == API_OPENGLES2; - for (u = 0; u < Elements(ctx->Texture.Unit); u++) + for (u = 0; u < ARRAY_SIZE(ctx->Texture.Unit); u++) init_texture_unit(ctx, u); /* After we're done initializing the context's texture state the default @@ -927,7 +927,7 @@ _mesa_free_texture_data(struct gl_context *ctx) GLuint u, tgt; /* unreference current textures */ - for (u = 0; u < Elements(ctx->Texture.Unit); u++) { + for (u = 0; u < ARRAY_SIZE(ctx->Texture.Unit); u++) { /* The _Current texture could account for another reference */ _mesa_reference_texobj(&ctx->Texture.Unit[u]._Current, NULL); @@ -943,7 +943,7 @@ _mesa_free_texture_data(struct gl_context *ctx) /* GL_ARB_texture_buffer_object */ _mesa_reference_buffer_object(ctx, &ctx->Texture.BufferObject, NULL); - for (u = 0; u < Elements(ctx->Texture.Unit); u++) { + for (u = 0; u < ARRAY_SIZE(ctx->Texture.Unit); u++) { _mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[u].Sampler, NULL); } } @@ -959,7 +959,7 @@ _mesa_update_default_objects_texture(struct gl_context *ctx) { GLuint u, tex; - for (u = 0; u < Elements(ctx->Texture.Unit); u++) { + for (u = 0; u < ARRAY_SIZE(ctx->Texture.Unit); u++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u]; for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { _mesa_reference_texobj(&texUnit->CurrentTex[tex], diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index ce7b5d7f2d1..662435b47cc 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -41,7 +41,7 @@ static inline struct gl_texture_unit * _mesa_get_tex_unit(struct gl_context *ctx, GLuint unit) { - assert(unit < Elements(ctx->Texture.Unit)); + assert(unit < ARRAY_SIZE(ctx->Texture.Unit)); return &(ctx->Texture.Unit[unit]); } diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index 3ace5e8bbcf..53cb2c091f8 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -171,7 +171,7 @@ clear_texture_fields(struct gl_context *ctx, GLint level; GLuint face; - for (level = 0; level < Elements(texObj->Image[0]); level++) { + for (level = 0; level < ARRAY_SIZE(texObj->Image[0]); level++) { for (face = 0; face < numFaces; face++) { struct gl_texture_image *texImage = get_tex_image(ctx, texObj, face, level); diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 1e23e8fc2ff..a3e23ced5af 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -235,7 +235,7 @@ delete_transform_feedback(struct gl_context *ctx, { GLuint i; - for (i = 0; i < Elements(obj->Buffers); i++) { + for (i = 0; i < ARRAY_SIZE(obj->Buffers); i++) { _mesa_reference_buffer_object(ctx, &obj->Buffers[i], NULL); } diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 40327fba4b1..9f82de95254 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -762,7 +762,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, * been modified. */ bool changed = false; - for (unsigned j = 0; j < Elements(prog->SamplerUnits); j++) { + for (unsigned j = 0; j < ARRAY_SIZE(prog->SamplerUnits); j++) { if ((sh->active_samplers & (1U << j)) != 0 && (prog->SamplerUnits[j] != sh->SamplerUnits[j])) { changed = true; diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index 4bb3dfbcd94..fb1482f9ceb 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -81,7 +81,7 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg, if (prog->SamplersUsed & (1 << s)) { GLuint unit = shader->SamplerUnits[s]; GLuint tgt = shader->SamplerTargets[s]; - assert(unit < Elements(prog->TexturesUsed)); + assert(unit < ARRAY_SIZE(prog->TexturesUsed)); assert(tgt < NUM_TEXTURE_TARGETS); /* The types of the samplers associated with a particular texture diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 6df50de6aa0..3db9e06d37d 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -714,7 +714,7 @@ _mesa_EnableVertexAttribArray(GLuint index) vao = ctx->Array.VAO; - assert(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); + assert(VERT_ATTRIB_GENERIC(index) < ARRAY_SIZE(vao->VertexAttrib)); if (!vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { /* was disabled, now being enabled */ @@ -740,7 +740,7 @@ _mesa_DisableVertexAttribArray(GLuint index) vao = ctx->Array.VAO; - assert(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); + assert(VERT_ATTRIB_GENERIC(index) < ARRAY_SIZE(vao->VertexAttrib)); if (vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { /* was enabled, now being disabled */ @@ -769,7 +769,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, return 0; } - assert(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); + assert(VERT_ATTRIB_GENERIC(index) < ARRAY_SIZE(vao->VertexAttrib)); array = &vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)]; @@ -834,7 +834,7 @@ get_current_attrib(struct gl_context *ctx, GLuint index, const char *function) return NULL; } - assert(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->VertexAttrib)); + assert(VERT_ATTRIB_GENERIC(index) < ARRAY_SIZE(ctx->Array.VAO->VertexAttrib)); FLUSH_CURRENT(ctx, 0); return ctx->Current.Attrib[VERT_ATTRIB_GENERIC(index)]; @@ -956,7 +956,7 @@ _mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer) return; } - assert(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->VertexAttrib)); + assert(VERT_ATTRIB_GENERIC(index) < ARRAY_SIZE(ctx->Array.VAO->VertexAttrib)); *pointer = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Ptr; } @@ -1348,7 +1348,7 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor) return; } - assert(genericIndex < Elements(ctx->Array.VAO->VertexAttrib)); + assert(genericIndex < ARRAY_SIZE(ctx->Array.VAO->VertexAttrib)); /* The ARB_vertex_attrib_binding spec says: * @@ -1803,7 +1803,7 @@ _mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex) } assert(VERT_ATTRIB_GENERIC(attribIndex) < - Elements(ctx->Array.VAO->VertexAttrib)); + ARRAY_SIZE(ctx->Array.VAO->VertexAttrib)); vertex_attrib_binding(ctx, VERT_ATTRIB_GENERIC(attribIndex), VERT_ATTRIB_GENERIC(bindingIndex)); |