aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2016-04-25 15:53:04 -0600
committerBrian Paul <[email protected]>2016-04-27 10:23:19 -0600
commitf93802c465b021592837c846d713146ddc1a8155 (patch)
treefebd0e2fe18c326c0de10d48c870ad617b7a1b7d /src/gallium
parent562c4a17b7e4fb56c7db679233b4a48f8b80b0f2 (diff)
softpipe: s/Elements/ARRAY_SIZE/
Try to standardize on the later, which is defined in the common util/ directory. Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/softpipe/sp_context.c16
-rw-r--r--src/gallium/drivers/softpipe/sp_flush.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_state_derived.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_state_image.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_state_sampler.c8
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_tile_cache.c10
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c10
7 files changed, 27 insertions, 27 deletions
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index 1690e38f1ca..323f74ff3bd 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -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;
diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c
index 59b8ad696ec..29fcf7f1628 100644
--- a/src/gallium/drivers/softpipe/sp_flush.c
+++ b/src/gallium/drivers/softpipe/sp_flush.c
@@ -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]);
}
diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c
index 92b73783ca8..9b1d283b4ff 100644
--- a/src/gallium/drivers/softpipe/sp_state_derived.c
+++ b/src/gallium/drivers/softpipe/sp_state_derived.c
@@ -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) {
diff --git a/src/gallium/drivers/softpipe/sp_state_image.c b/src/gallium/drivers/softpipe/sp_state_image.c
index 5947c934e86..b1810d3591f 100644
--- a/src/gallium/drivers/softpipe/sp_state_image.c
+++ b/src/gallium/drivers/softpipe/sp_state_image.c
@@ -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++) {
diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c
index f917147754d..0d5149c1df4 100644
--- a/src/gallium/drivers/softpipe/sp_state_sampler.c
+++ b/src/gallium/drivers/softpipe/sp_state_sampler.c
@@ -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);
}
}
diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
index 21f38b2f859..8fbc972aa85 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
@@ -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;
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index 0ebe082e8eb..351736ee421 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -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;