Mesa (master): swr: s/Elements/ARRAY_SIZE/

Tim Rowley torowley at kemper.freedesktop.org
Wed Apr 27 16:08:25 UTC 2016


Module: Mesa
Branch: master
Commit: 504df3a1d791d071259d23b4a99b9b46b1f601af
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=504df3a1d791d071259d23b4a99b9b46b1f601af

Author: Tim Rowley <timothy.o.rowley at intel.com>
Date:   Wed Apr 27 10:12:44 2016 -0500

swr: s/Elements/ARRAY_SIZE/

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>

---

 src/gallium/drivers/swr/swr_context.cpp    | 4 ++--
 src/gallium/drivers/swr/swr_state.cpp      | 6 +++---
 src/gallium/drivers/swr/swr_tex_sample.cpp | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp
index 5d311dd..3a5d9e0 100644
--- a/src/gallium/drivers/swr/swr_context.cpp
+++ b/src/gallium/drivers/swr/swr_context.cpp
@@ -307,11 +307,11 @@ swr_destroy(struct pipe_context *pipe)
 
    pipe_surface_reference(&ctx->framebuffer.zsbuf, NULL);
 
-   for (unsigned i = 0; i < Elements(ctx->sampler_views[0]); i++) {
+   for (unsigned i = 0; i < ARRAY_SIZE(ctx->sampler_views[0]); i++) {
       pipe_sampler_view_reference(&ctx->sampler_views[PIPE_SHADER_FRAGMENT][i], NULL);
    }
 
-   for (unsigned i = 0; i < Elements(ctx->sampler_views[0]); i++) {
+   for (unsigned i = 0; i < ARRAY_SIZE(ctx->sampler_views[0]); i++) {
       pipe_sampler_view_reference(&ctx->sampler_views[PIPE_SHADER_VERTEX][i], NULL);
    }
 
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
index 7eb9049..12916f6 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -239,7 +239,7 @@ swr_bind_sampler_states(struct pipe_context *pipe,
    unsigned i;
 
    assert(shader < PIPE_SHADER_TYPES);
-   assert(start + num <= Elements(ctx->samplers[shader]));
+   assert(start + num <= ARRAY_SIZE(ctx->samplers[shader]));
 
    /* set the new samplers */
    ctx->num_samplers[shader] = num;
@@ -288,7 +288,7 @@ swr_set_sampler_views(struct pipe_context *pipe,
    assert(num <= PIPE_MAX_SHADER_SAMPLER_VIEWS);
 
    assert(shader < PIPE_SHADER_TYPES);
-   assert(start + num <= Elements(ctx->sampler_views[shader]));
+   assert(start + num <= ARRAY_SIZE(ctx->sampler_views[shader]));
 
    /* set the new sampler views */
    ctx->num_sampler_views[shader] = num;
@@ -415,7 +415,7 @@ swr_set_constant_buffer(struct pipe_context *pipe,
    struct pipe_resource *constants = cb ? cb->buffer : NULL;
 
    assert(shader < PIPE_SHADER_TYPES);
-   assert(index < Elements(ctx->constants[shader]));
+   assert(index < ARRAY_SIZE(ctx->constants[shader]));
 
    /* note: reference counting */
    util_copy_constant_buffer(&ctx->constants[shader][index], cb);
diff --git a/src/gallium/drivers/swr/swr_tex_sample.cpp b/src/gallium/drivers/swr/swr_tex_sample.cpp
index 66d6b0f..180ade1 100644
--- a/src/gallium/drivers/swr/swr_tex_sample.cpp
+++ b/src/gallium/drivers/swr/swr_tex_sample.cpp
@@ -131,7 +131,7 @@ swr_texture_member(const struct lp_sampler_dynamic_state *base,
    /* context[0].textures[unit].member */
    indices[3] = lp_build_const_int32(gallivm, member_index);
 
-   ptr = LLVMBuildGEP(builder, context_ptr, indices, Elements(indices), "");
+   ptr = LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
 
    if (emit_load)
       res = LLVMBuildLoad(builder, ptr, "");
@@ -225,7 +225,7 @@ swr_sampler_member(const struct lp_sampler_dynamic_state *base,
    /* context[0].samplers[unit].member */
    indices[3] = lp_build_const_int32(gallivm, member_index);
 
-   ptr = LLVMBuildGEP(builder, context_ptr, indices, Elements(indices), "");
+   ptr = LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
 
    if (emit_load)
       res = LLVMBuildLoad(builder, ptr, "");




More information about the mesa-commit mailing list