mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
softpipe: s/Elements/ARRAY_SIZE/
Try to standardize on the later, which is defined in the common util/ directory. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
562c4a17b7
commit
f93802c465
7 changed files with 27 additions and 27 deletions
|
|
@ -94,15 +94,15 @@ softpipe_destroy( struct pipe_context *pipe )
|
|||
sp_destroy_tile_cache(softpipe->zsbuf_cache);
|
||||
pipe_surface_reference(&softpipe->framebuffer.zsbuf, NULL);
|
||||
|
||||
for (sh = 0; sh < Elements(softpipe->tex_cache); sh++) {
|
||||
for (i = 0; i < Elements(softpipe->tex_cache[0]); i++) {
|
||||
for (sh = 0; sh < ARRAY_SIZE(softpipe->tex_cache); sh++) {
|
||||
for (i = 0; i < ARRAY_SIZE(softpipe->tex_cache[0]); i++) {
|
||||
sp_destroy_tex_tile_cache(softpipe->tex_cache[sh][i]);
|
||||
pipe_sampler_view_reference(&softpipe->sampler_views[sh][i], NULL);
|
||||
}
|
||||
}
|
||||
|
||||
for (sh = 0; sh < Elements(softpipe->constants); sh++) {
|
||||
for (i = 0; i < Elements(softpipe->constants[0]); i++) {
|
||||
for (sh = 0; sh < ARRAY_SIZE(softpipe->constants); sh++) {
|
||||
for (i = 0; i < ARRAY_SIZE(softpipe->constants[0]); i++) {
|
||||
if (softpipe->constants[sh][i]) {
|
||||
pipe_resource_reference(&softpipe->constants[sh][i], NULL);
|
||||
}
|
||||
|
|
@ -159,8 +159,8 @@ softpipe_is_resource_referenced( struct pipe_context *pipe,
|
|||
}
|
||||
|
||||
/* check if any of the tex_cache textures are this texture */
|
||||
for (sh = 0; sh < Elements(softpipe->tex_cache); sh++) {
|
||||
for (i = 0; i < Elements(softpipe->tex_cache[0]); i++) {
|
||||
for (sh = 0; sh < ARRAY_SIZE(softpipe->tex_cache); sh++) {
|
||||
for (i = 0; i < ARRAY_SIZE(softpipe->tex_cache[0]); i++) {
|
||||
if (softpipe->tex_cache[sh][i] &&
|
||||
softpipe->tex_cache[sh][i]->texture == texture)
|
||||
return SP_REFERENCED_FOR_READ;
|
||||
|
|
@ -251,8 +251,8 @@ softpipe_create_context(struct pipe_screen *screen,
|
|||
softpipe->zsbuf_cache = sp_create_tile_cache( &softpipe->pipe );
|
||||
|
||||
/* Allocate texture caches */
|
||||
for (sh = 0; sh < Elements(softpipe->tex_cache); sh++) {
|
||||
for (i = 0; i < Elements(softpipe->tex_cache[0]); i++) {
|
||||
for (sh = 0; sh < ARRAY_SIZE(softpipe->tex_cache); sh++) {
|
||||
for (i = 0; i < ARRAY_SIZE(softpipe->tex_cache[0]); i++) {
|
||||
softpipe->tex_cache[sh][i] = sp_create_tex_tile_cache(&softpipe->pipe);
|
||||
if (!softpipe->tex_cache[sh][i])
|
||||
goto fail;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ softpipe_flush( struct pipe_context *pipe,
|
|||
if (flags & SP_FLUSH_TEXTURE_CACHE) {
|
||||
unsigned sh;
|
||||
|
||||
for (sh = 0; sh < Elements(softpipe->tex_cache); sh++) {
|
||||
for (sh = 0; sh < ARRAY_SIZE(softpipe->tex_cache); sh++) {
|
||||
for (i = 0; i < softpipe->num_sampler_views[sh]; i++) {
|
||||
sp_flush_tex_tile_cache(softpipe->tex_cache[sh][i]);
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ void softpipe_texture_barrier(struct pipe_context *pipe)
|
|||
struct softpipe_context *softpipe = softpipe_context(pipe);
|
||||
uint i, sh;
|
||||
|
||||
for (sh = 0; sh < Elements(softpipe->tex_cache); sh++) {
|
||||
for (sh = 0; sh < ARRAY_SIZE(softpipe->tex_cache); sh++) {
|
||||
for (i = 0; i < softpipe->num_sampler_views[sh]; i++) {
|
||||
sp_flush_tex_tile_cache(softpipe->tex_cache[sh][i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ update_tgsi_samplers( struct softpipe_context *softpipe )
|
|||
}
|
||||
|
||||
/* XXX is this really necessary here??? */
|
||||
for (sh = 0; sh < Elements(softpipe->tex_cache); sh++) {
|
||||
for (sh = 0; sh < ARRAY_SIZE(softpipe->tex_cache); sh++) {
|
||||
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
|
||||
struct softpipe_tex_tile_cache *tc = softpipe->tex_cache[sh][i];
|
||||
if (tc && tc->texture) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ static void softpipe_set_shader_images(struct pipe_context *pipe,
|
|||
struct softpipe_context *softpipe = softpipe_context(pipe);
|
||||
unsigned i;
|
||||
assert(shader < PIPE_SHADER_TYPES);
|
||||
assert(start + num <= Elements(softpipe->sampler_views[shader]));
|
||||
assert(start + num <= ARRAY_SIZE(softpipe->sampler_views[shader]));
|
||||
|
||||
/* set the new images */
|
||||
for (i = 0; i < num; i++) {
|
||||
|
|
@ -61,7 +61,7 @@ static void softpipe_set_shader_buffers(struct pipe_context *pipe,
|
|||
struct softpipe_context *softpipe = softpipe_context(pipe);
|
||||
unsigned i;
|
||||
assert(shader < PIPE_SHADER_TYPES);
|
||||
assert(start + num <= Elements(softpipe->buffers[shader]));
|
||||
assert(start + num <= ARRAY_SIZE(softpipe->buffers[shader]));
|
||||
|
||||
/* set the new images */
|
||||
for (i = 0; i < num; i++) {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ softpipe_bind_sampler_states(struct pipe_context *pipe,
|
|||
unsigned i;
|
||||
|
||||
assert(shader < PIPE_SHADER_TYPES);
|
||||
assert(start + num <= Elements(softpipe->samplers[shader]));
|
||||
assert(start + num <= ARRAY_SIZE(softpipe->samplers[shader]));
|
||||
|
||||
draw_flush(softpipe->draw);
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ softpipe_set_sampler_views(struct pipe_context *pipe,
|
|||
uint i;
|
||||
|
||||
assert(shader < PIPE_SHADER_TYPES);
|
||||
assert(start + num <= Elements(softpipe->sampler_views[shader]));
|
||||
assert(start + num <= ARRAY_SIZE(softpipe->sampler_views[shader]));
|
||||
|
||||
draw_flush(softpipe->draw);
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ void
|
|||
softpipe_cleanup_vertex_sampling(struct softpipe_context *ctx)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < Elements(ctx->mapped_vs_tex); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(ctx->mapped_vs_tex); i++) {
|
||||
pipe_resource_reference(&ctx->mapped_vs_tex[i], NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -311,7 +311,7 @@ void
|
|||
softpipe_cleanup_geometry_sampling(struct softpipe_context *ctx)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < Elements(ctx->mapped_gs_tex); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(ctx->mapped_gs_tex); i++) {
|
||||
pipe_resource_reference(&ctx->mapped_gs_tex[i], NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ sp_create_tex_tile_cache( struct pipe_context *pipe )
|
|||
tc = CALLOC_STRUCT( softpipe_tex_tile_cache );
|
||||
if (tc) {
|
||||
tc->pipe = pipe;
|
||||
for (pos = 0; pos < Elements(tc->entries); pos++) {
|
||||
for (pos = 0; pos < ARRAY_SIZE(tc->entries); pos++) {
|
||||
tc->entries[pos].addr.bits.invalid = 1;
|
||||
}
|
||||
tc->last_tile = &tc->entries[0]; /* any tile */
|
||||
|
|
@ -70,7 +70,7 @@ sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc)
|
|||
if (tc) {
|
||||
uint pos;
|
||||
|
||||
for (pos = 0; pos < Elements(tc->entries); pos++) {
|
||||
for (pos = 0; pos < ARRAY_SIZE(tc->entries); pos++) {
|
||||
/*assert(tc->entries[pos].x < 0);*/
|
||||
}
|
||||
if (tc->transfer) {
|
||||
|
|
@ -97,7 +97,7 @@ sp_tex_tile_cache_validate_texture(struct softpipe_tex_tile_cache *tc)
|
|||
assert(tc);
|
||||
assert(tc->texture);
|
||||
|
||||
for (i = 0; i < Elements(tc->entries); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(tc->entries); i++) {
|
||||
tc->entries[i].addr.bits.invalid = 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ sp_tex_tile_cache_set_sampler_view(struct softpipe_tex_tile_cache *tc,
|
|||
|
||||
/* mark as entries as invalid/empty */
|
||||
/* XXX we should try to avoid this when the teximage hasn't changed */
|
||||
for (i = 0; i < Elements(tc->entries); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(tc->entries); i++) {
|
||||
tc->entries[i].addr.bits.invalid = 1;
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ sp_flush_tex_tile_cache(struct softpipe_tex_tile_cache *tc)
|
|||
|
||||
if (tc->texture) {
|
||||
/* caching a texture, mark all entries as empty */
|
||||
for (pos = 0; pos < Elements(tc->entries); pos++) {
|
||||
for (pos = 0; pos < ARRAY_SIZE(tc->entries); pos++) {
|
||||
tc->entries[pos].addr.bits.invalid = 1;
|
||||
}
|
||||
tc->tex_z = -1;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ sp_create_tile_cache( struct pipe_context *pipe )
|
|||
tc = CALLOC_STRUCT( softpipe_tile_cache );
|
||||
if (tc) {
|
||||
tc->pipe = pipe;
|
||||
for (pos = 0; pos < Elements(tc->tile_addrs); pos++) {
|
||||
for (pos = 0; pos < ARRAY_SIZE(tc->tile_addrs); pos++) {
|
||||
tc->tile_addrs[pos].bits.invalid = 1;
|
||||
}
|
||||
tc->last_tile_addr.bits.invalid = 1;
|
||||
|
|
@ -142,7 +142,7 @@ sp_destroy_tile_cache(struct softpipe_tile_cache *tc)
|
|||
if (tc) {
|
||||
uint pos;
|
||||
|
||||
for (pos = 0; pos < Elements(tc->entries); pos++) {
|
||||
for (pos = 0; pos < ARRAY_SIZE(tc->entries); pos++) {
|
||||
/*assert(tc->entries[pos].x < 0);*/
|
||||
FREE( tc->entries[pos] );
|
||||
}
|
||||
|
|
@ -448,7 +448,7 @@ sp_flush_tile_cache(struct softpipe_tile_cache *tc)
|
|||
int i;
|
||||
if (tc->num_maps) {
|
||||
/* caching a drawing transfer */
|
||||
for (pos = 0; pos < Elements(tc->entries); pos++) {
|
||||
for (pos = 0; pos < ARRAY_SIZE(tc->entries); pos++) {
|
||||
struct softpipe_cached_tile *tile = tc->entries[pos];
|
||||
if (!tile)
|
||||
{
|
||||
|
|
@ -485,7 +485,7 @@ sp_alloc_tile(struct softpipe_tile_cache *tc)
|
|||
if (!tc->tile)
|
||||
{
|
||||
unsigned pos;
|
||||
for (pos = 0; pos < Elements(tc->entries); ++pos) {
|
||||
for (pos = 0; pos < ARRAY_SIZE(tc->entries); ++pos) {
|
||||
if (!tc->entries[pos])
|
||||
continue;
|
||||
|
||||
|
|
@ -645,7 +645,7 @@ sp_tile_cache_clear(struct softpipe_tile_cache *tc,
|
|||
/* set flags to indicate all the tiles are cleared */
|
||||
memset(tc->clear_flags, 255, tc->clear_flags_size);
|
||||
|
||||
for (pos = 0; pos < Elements(tc->tile_addrs); pos++) {
|
||||
for (pos = 0; pos < ARRAY_SIZE(tc->tile_addrs); pos++) {
|
||||
tc->tile_addrs[pos].bits.invalid = 1;
|
||||
}
|
||||
tc->last_tile_addr.bits.invalid = 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue