gallium/util: s/Elements/ARRAY_SIZE/
authorBrian Paul <brianp@vmware.com>
Wed, 27 Apr 2016 00:10:00 +0000 (18:10 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 28 Apr 2016 15:04:24 +0000 (09:04 -0600)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/auxiliary/util/u_blit.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_dump_defines.c
src/gallium/auxiliary/util/u_dump_state.c
src/gallium/auxiliary/util/u_format_tests.c
src/gallium/auxiliary/util/u_framebuffer.c
src/gallium/auxiliary/util/u_simple_shaders.c
src/gallium/auxiliary/util/u_tests.c
src/gallium/auxiliary/util/u_vbuf.c

index 3677515423ca5d9ede75130e5c88b26ce2537f50..5bcd8bbceef821708392e3cc127b308e95f862c0 100644 (file)
@@ -140,9 +140,9 @@ util_destroy_blit(struct blit_state *ctx)
    if (ctx->vs)
       pipe->delete_vs_state(pipe, ctx->vs);
 
-   for (i = 0; i < Elements(ctx->fs); i++) {
-      for (j = 0; j < Elements(ctx->fs[i]); j++) {
-         for (k = 0; k < Elements(ctx->fs[i][j]); k++) {
+   for (i = 0; i < ARRAY_SIZE(ctx->fs); i++) {
+      for (j = 0; j < ARRAY_SIZE(ctx->fs[i]); j++) {
+         for (k = 0; k < ARRAY_SIZE(ctx->fs[i][j]); k++) {
             if (ctx->fs[i][j][k])
                pipe->delete_fs_state(pipe, ctx->fs[i][j][k]);
          }
index 8d7cc9630d9b7b3a4f992c9a6310eaf55686d04d..958d2ab7ea405bcf9f24cc89dacc89289b11b5a7 100644 (file)
@@ -428,7 +428,7 @@ void util_blitter_destroy(struct blitter_context *blitter)
       for (j = 0; j < 2; j++)
          pipe->delete_blend_state(pipe, ctx->blend[i][j]);
 
-   for (i = 0; i < Elements(ctx->blend_clear); i++) {
+   for (i = 0; i < ARRAY_SIZE(ctx->blend_clear); i++) {
       if (ctx->blend_clear[i])
          pipe->delete_blend_state(pipe, ctx->blend_clear[i]);
    }
@@ -483,17 +483,17 @@ void util_blitter_destroy(struct blitter_context *blitter)
       if (ctx->fs_texfetch_stencil_msaa[i])
          ctx->delete_fs_state(pipe, ctx->fs_texfetch_stencil_msaa[i]);
 
-      for (j = 0; j< Elements(ctx->fs_resolve[i]); j++)
+      for (j = 0; j< ARRAY_SIZE(ctx->fs_resolve[i]); j++)
          for (f = 0; f < 2; f++)
             if (ctx->fs_resolve[i][j][f])
                ctx->delete_fs_state(pipe, ctx->fs_resolve[i][j][f]);
 
-      for (j = 0; j< Elements(ctx->fs_resolve_sint[i]); j++)
+      for (j = 0; j< ARRAY_SIZE(ctx->fs_resolve_sint[i]); j++)
          for (f = 0; f < 2; f++)
             if (ctx->fs_resolve_sint[i][j][f])
                ctx->delete_fs_state(pipe, ctx->fs_resolve_sint[i][j][f]);
 
-      for (j = 0; j< Elements(ctx->fs_resolve_uint[i]); j++)
+      for (j = 0; j< ARRAY_SIZE(ctx->fs_resolve_uint[i]); j++)
          for (f = 0; f < 2; f++)
             if (ctx->fs_resolve_uint[i][j][f])
                ctx->delete_fs_state(pipe, ctx->fs_resolve_uint[i][j][f]);
index 3ddc9554b502cb5e732bae72afafa201de0ad0b8..9d831efcf514c0727500db3785c296454e4ee9c8 100644 (file)
@@ -67,9 +67,9 @@ util_dump_enum_continuous(unsigned value,
    util_dump_##_name(unsigned value, boolean shortened) \
    { \
       if(shortened) \
-         return util_dump_enum_continuous(value, Elements(util_dump_##_name##_short_names), util_dump_##_name##_short_names); \
+         return util_dump_enum_continuous(value, ARRAY_SIZE(util_dump_##_name##_short_names), util_dump_##_name##_short_names); \
       else \
-         return util_dump_enum_continuous(value, Elements(util_dump_##_name##_names), util_dump_##_name##_names); \
+         return util_dump_enum_continuous(value, ARRAY_SIZE(util_dump_##_name##_names), util_dump_##_name##_names); \
    }
 
 
@@ -81,12 +81,12 @@ util_dump_enum_continuous(unsigned value,
    const char * \
    util_dump_##_name(unsigned value, boolean shortened) \
    { \
-      STATIC_ASSERT(Elements(util_dump_##_name##_names) == _count); \
-      STATIC_ASSERT(Elements(util_dump_##_name##_short_names) == _count); \
+      STATIC_ASSERT(ARRAY_SIZE(util_dump_##_name##_names) == _count); \
+      STATIC_ASSERT(ARRAY_SIZE(util_dump_##_name##_short_names) == _count); \
       if(shortened) \
-         return util_dump_enum_continuous(value, Elements(util_dump_##_name##_short_names), util_dump_##_name##_short_names); \
+         return util_dump_enum_continuous(value, ARRAY_SIZE(util_dump_##_name##_short_names), util_dump_##_name##_short_names); \
       else \
-         return util_dump_enum_continuous(value, Elements(util_dump_##_name##_names), util_dump_##_name##_names); \
+         return util_dump_enum_continuous(value, ARRAY_SIZE(util_dump_##_name##_names), util_dump_##_name##_names); \
    }
 
 
index b1f3982fb4ef48f9054a0e44c78ceb1ca05060a9..bad38fb96693d8d6e3c6d557ac3aa3c4e957bba3 100644 (file)
@@ -474,7 +474,7 @@ util_dump_shader_state(FILE *stream, const struct pipe_shader_state *state)
       util_dump_struct_begin(stream, "pipe_stream_output_info");
       util_dump_member(stream, uint, &state->stream_output, num_outputs);
       util_dump_array(stream, uint, state->stream_output.stride,
-                      Elements(state->stream_output.stride));
+                      ARRAY_SIZE(state->stream_output.stride));
       util_dump_array_begin(stream);
       for(i = 0; i < state->stream_output.num_outputs; ++i) {
          util_dump_elem_begin(stream);
@@ -519,7 +519,7 @@ util_dump_depth_stencil_alpha_state(FILE *stream, const struct pipe_depth_stenci
 
    util_dump_member_begin(stream, "stencil");
    util_dump_array_begin(stream);
-   for(i = 0; i < Elements(state->stencil); ++i) {
+   for(i = 0; i < ARRAY_SIZE(state->stencil); ++i) {
       util_dump_elem_begin(stream);
       util_dump_struct_begin(stream, "pipe_stencil_state");
       util_dump_member(stream, bool, &state->stencil[i], enabled);
index 64224cd2e81cd5b870e50c11cf678990ede7195f..3075ea0abefa4b089e4ffb6d3555c729d8706008 100644 (file)
@@ -1008,4 +1008,4 @@ util_format_test_cases[] =
 };
 
 
-const unsigned util_format_nr_test_cases = Elements(util_format_test_cases);
+const unsigned util_format_nr_test_cases = ARRAY_SIZE(util_format_test_cases);
index f9b804673dc991c01e09ed4ff3474c7d7418ad9c..deaa05875090492e9ee11b073435832ca89d4c14 100644 (file)
@@ -96,7 +96,7 @@ util_copy_framebuffer_state(struct pipe_framebuffer_state *dst,
       pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]);
 
    /* Set remaining dest cbuf pointers to NULL */
-   for ( ; i < Elements(dst->cbufs); i++)
+   for ( ; i < ARRAY_SIZE(dst->cbufs); i++)
       pipe_surface_reference(&dst->cbufs[i], NULL);
 
    dst->nr_cbufs = src->nr_cbufs;
index 8c739da1ee8270a27c300bf51ecf76bf192fb2af..8a32dbc0fb8d7805221fd58cf55e6f9f7b3d2b0c 100644 (file)
@@ -123,7 +123,7 @@ void *util_make_layered_clear_vertex_shader(struct pipe_context *pipe)
    struct tgsi_token tokens[1000];
    struct pipe_shader_state state = {tokens};
 
-   if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+   if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
       assert(0);
       return NULL;
    }
@@ -151,7 +151,7 @@ void *util_make_layered_clear_helper_vertex_shader(struct pipe_context *pipe)
    struct tgsi_token tokens[1000];
    struct pipe_shader_state state = {tokens};
 
-   if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+   if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
       assert(0);
       return NULL;
    }
@@ -194,7 +194,7 @@ void *util_make_layered_clear_geometry_shader(struct pipe_context *pipe)
    struct tgsi_token tokens[1000];
    struct pipe_shader_state state = {tokens};
 
-   if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+   if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
       assert(0);
       return NULL;
    }
@@ -478,7 +478,7 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe,
            tgsi_semantic_names[input_semantic],
            tgsi_interpolate_names[input_interpolate]);
 
-   if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+   if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
       assert(0);
       return NULL;
    }
@@ -566,7 +566,7 @@ util_make_fs_blit_msaa_gen(struct pipe_context *pipe,
    sprintf(text, shader_templ, type, samp_type,
            output_semantic, output_mask, type);
 
-   if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+   if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
       puts(text);
       assert(0);
       return NULL;
@@ -666,7 +666,7 @@ util_make_fs_blit_msaa_depthstencil(struct pipe_context *pipe,
 
    sprintf(text, shader_templ, type, type, type);
 
-   if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+   if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
       assert(0);
       return NULL;
    }
index 006dfa95af2e9ff1f88e19b270a24738a543e512..e6998281bc9b037ddb8c4c7e848ea86df1eba15b 100644 (file)
@@ -424,7 +424,7 @@ null_constant_buffer(struct pipe_context *ctx)
       struct tgsi_token tokens[1000];
       struct pipe_shader_state state = {tokens};
 
-      if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+      if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
          puts("Can't compile a fragment shader.");
          util_report_result(FAIL);
          return;
index e16ee3651e6363b07a120b8c94e0874f063149cd..c4c26949b8db4b6d2850553848c62ffe6e8065af 100644 (file)
@@ -269,7 +269,7 @@ boolean u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps)
    for (i = 0; i < PIPE_FORMAT_COUNT; i++)
       caps->format_translation[i] = i;
 
-   for (i = 0; i < Elements(vbuf_format_fallbacks); i++) {
+   for (i = 0; i < ARRAY_SIZE(vbuf_format_fallbacks); i++) {
       enum pipe_format format = vbuf_format_fallbacks[i].from;
 
       if (!screen->is_format_supported(screen, format, PIPE_BUFFER, 0,