summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorJan Vesely <[email protected]>2016-05-17 09:25:44 -0400
committerJan Vesely <[email protected]>2016-05-17 15:28:04 -0400
commit47b390fe45e5e6f982c60b58985892438959cd8e (patch)
tree61a26199f85287a7e918c6c52db243280b6a3cba /src/gallium/drivers
parent322cd2457ccf66a0a88d92f0b0dec1cb3f93eae4 (diff)
Treewide: Remove Elements() macro
Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp2
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp6
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp4
-rw-r--r--src/gallium/drivers/nouveau/nouveau_compiler.c2
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_tex.c4
-rw-r--r--src/gallium/drivers/r300/r300_chipset.c2
-rw-r--r--src/gallium/drivers/r300/r300_vs_draw.c8
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c12
-rw-r--r--src/gallium/drivers/r600/r600_shader.c10
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c6
-rw-r--r--src/gallium/drivers/r600/sb/sb_bc_parser.cpp2
-rw-r--r--src/gallium/drivers/radeon/r600_query.c6
-rw-r--r--src/gallium/drivers/radeon/r600_texture.c2
-rw-r--r--src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c4
-rw-r--r--src/gallium/drivers/radeon/radeon_video.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_descriptors.c8
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c6
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.c4
20 files changed, 47 insertions, 47 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index e62ac064d59..cd801f342dd 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -2472,7 +2472,7 @@ MemoryOpt::replaceStFromSt(Instruction *restrict st, Record *rec)
// get non-replaced sources after values covered by st
for (; offR < endR; offR += ri->getSrc(s)->reg.size, ++s)
vals[k++] = ri->getSrc(s);
- assert((unsigned int)k <= Elements(vals));
+ assert((unsigned int)k <= ARRAY_SIZE(vals));
for (s = 0; s < k; ++s)
st->setSrc(s + 1, vals[s]);
st->setSrc(0, ri->getSrc(0));
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
index 7fdbafa8c70..756a4d8ac88 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
@@ -547,16 +547,16 @@ void Instruction::print() const
switch (op) {
case OP_SUREDP:
case OP_ATOM:
- if (subOp < Elements(atomSubOpStr))
+ if (subOp < ARRAY_SIZE(atomSubOpStr))
PRINT("%s ", atomSubOpStr[subOp]);
break;
case OP_LOAD:
case OP_STORE:
- if (subOp < Elements(ldstSubOpStr))
+ if (subOp < ARRAY_SIZE(ldstSubOpStr))
PRINT("%s ", ldstSubOpStr[subOp]);
break;
case OP_SUBFM:
- if (subOp < Elements(subfmOpStr))
+ if (subOp < ARRAY_SIZE(subfmOpStr))
PRINT("%s ", subfmOpStr[subOp]);
break;
default:
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
index b147baf3d62..cc98d325c71 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
@@ -145,8 +145,8 @@ extern Target *getTargetNV50(unsigned int chipset);
Target *Target::create(unsigned int chipset)
{
- STATIC_ASSERT(Elements(operationSrcNr) == OP_LAST + 1);
- STATIC_ASSERT(Elements(operationClass) == OP_LAST + 1);
+ STATIC_ASSERT(ARRAY_SIZE(operationSrcNr) == OP_LAST + 1);
+ STATIC_ASSERT(ARRAY_SIZE(operationClass) == OP_LAST + 1);
switch (chipset & ~0xf) {
case 0x110:
case 0x120:
diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c
index ca73fd17a43..e00ad3fc0b8 100644
--- a/src/gallium/drivers/nouveau/nouveau_compiler.c
+++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
@@ -197,7 +197,7 @@ main(int argc, char *argv[])
return 1;
}
- if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
+ if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
_debug_printf("Failed to parse TGSI shader\n");
return 1;
}
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_tex.c b/src/gallium/drivers/nouveau/nv50/nv50_tex.c
index 36c07bc4fc3..953ab8f4364 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_tex.c
@@ -449,6 +449,6 @@ void nv50_upload_ms_info(struct nouveau_pushbuf *push)
{
BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
PUSH_DATA (push, (NV50_CB_AUX_MS_OFFSET << (8 - 2)) | NV50_CB_AUX);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), Elements(msaa_sample_xy_offsets));
- PUSH_DATAp(push, msaa_sample_xy_offsets, Elements(msaa_sample_xy_offsets));
+ BEGIN_NI04(push, NV50_3D(CB_DATA(0)), ARRAY_SIZE(msaa_sample_xy_offsets));
+ PUSH_DATAp(push, msaa_sample_xy_offsets, ARRAY_SIZE(msaa_sample_xy_offsets));
}
diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c
index c1c7ce3d0bf..505b764023a 100644
--- a/src/gallium/drivers/r300/r300_chipset.c
+++ b/src/gallium/drivers/r300/r300_chipset.c
@@ -53,7 +53,7 @@ static void r300_apply_hyperz_blacklist(struct r300_capabilities* caps)
if (!os_get_process_name(proc_name, sizeof(proc_name)))
return;
- for (i = 0; i < Elements(list); i++) {
+ for (i = 0; i < ARRAY_SIZE(list); i++) {
if (strcmp(list[i], proc_name) == 0) {
caps->zmask_ram = 0;
caps->hiz_ram = 0;
diff --git a/src/gallium/drivers/r300/r300_vs_draw.c b/src/gallium/drivers/r300/r300_vs_draw.c
index 45b7b9380d4..83bcaee08eb 100644
--- a/src/gallium/drivers/r300/r300_vs_draw.c
+++ b/src/gallium/drivers/r300/r300_vs_draw.c
@@ -112,7 +112,7 @@ static void insert_output_before(struct tgsi_transform_context *ctx,
unsigned i;
/* Make a place for the new output. */
- for (i = before->Range.First; i < Elements(vsctx->out_remap); i++) {
+ for (i = before->Range.First; i < ARRAY_SIZE(vsctx->out_remap); i++) {
++vsctx->out_remap[i];
}
@@ -131,7 +131,7 @@ static void insert_output_after(struct tgsi_transform_context *ctx,
unsigned i;
/* Make a place for the new output. */
- for (i = after->Range.First+1; i < Elements(vsctx->out_remap); i++) {
+ for (i = after->Range.First+1; i < ARRAY_SIZE(vsctx->out_remap); i++) {
++vsctx->out_remap[i];
}
@@ -234,7 +234,7 @@ static void transform_inst(struct tgsi_transform_context *ctx,
TGSI_INTERPOLATE_PERSPECTIVE, vsctx->num_outputs);
/* Find a free temp for POSITION. */
- for (i = 0; i < Elements(vsctx->temp_used); i++) {
+ for (i = 0; i < ARRAY_SIZE(vsctx->temp_used); i++) {
if (!vsctx->temp_used[i]) {
emit_temp(ctx, i);
vsctx->pos_temp = i;
@@ -325,7 +325,7 @@ void r300_draw_init_vertex_shader(struct r300_context *r300,
return;
memset(&transform, 0, sizeof(transform));
- for (i = 0; i < Elements(transform.out_remap); i++) {
+ for (i = 0; i < ARRAY_SIZE(transform.out_remap); i++) {
transform.out_remap[i] = i;
}
transform.last_generic = -1;
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 62152c03f7e..23dd475bf9e 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1504,18 +1504,18 @@ static void evergreen_emit_msaa_state(struct r600_context *rctx, int nr_samples,
nr_samples = 0;
break;
case 2:
- radeon_set_context_reg_seq(cs, R_028C1C_PA_SC_AA_SAMPLE_LOCS_0, Elements(eg_sample_locs_2x));
- radeon_emit_array(cs, eg_sample_locs_2x, Elements(eg_sample_locs_2x));
+ radeon_set_context_reg_seq(cs, R_028C1C_PA_SC_AA_SAMPLE_LOCS_0, ARRAY_SIZE(eg_sample_locs_2x));
+ radeon_emit_array(cs, eg_sample_locs_2x, ARRAY_SIZE(eg_sample_locs_2x));
max_dist = eg_max_dist_2x;
break;
case 4:
- radeon_set_context_reg_seq(cs, R_028C1C_PA_SC_AA_SAMPLE_LOCS_0, Elements(eg_sample_locs_4x));
- radeon_emit_array(cs, eg_sample_locs_4x, Elements(eg_sample_locs_4x));
+ radeon_set_context_reg_seq(cs, R_028C1C_PA_SC_AA_SAMPLE_LOCS_0, ARRAY_SIZE(eg_sample_locs_4x));
+ radeon_emit_array(cs, eg_sample_locs_4x, ARRAY_SIZE(eg_sample_locs_4x));
max_dist = eg_max_dist_4x;
break;
case 8:
- radeon_set_context_reg_seq(cs, R_028C1C_PA_SC_AA_SAMPLE_LOCS_0, Elements(sample_locs_8x));
- radeon_emit_array(cs, sample_locs_8x, Elements(sample_locs_8x));
+ radeon_set_context_reg_seq(cs, R_028C1C_PA_SC_AA_SAMPLE_LOCS_0, ARRAY_SIZE(sample_locs_8x));
+ radeon_emit_array(cs, sample_locs_8x, ARRAY_SIZE(sample_locs_8x));
max_dist = max_dist_8x;
break;
}
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index cd5ae449dee..101f666f683 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -858,7 +858,7 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx)
case TGSI_FILE_INPUT:
for (j = 0; j < count; j++) {
i = ctx->shader->ninput + j;
- assert(i < Elements(ctx->shader->input));
+ assert(i < ARRAY_SIZE(ctx->shader->input));
ctx->shader->input[i].name = d->Semantic.Name;
ctx->shader->input[i].sid = d->Semantic.Index + j;
ctx->shader->input[i].interpolate = d->Interp.Interpolate;
@@ -902,7 +902,7 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx)
case TGSI_FILE_OUTPUT:
for (j = 0; j < count; j++) {
i = ctx->shader->noutput + j;
- assert(i < Elements(ctx->shader->output));
+ assert(i < ARRAY_SIZE(ctx->shader->output));
ctx->shader->output[i].name = d->Semantic.Name;
ctx->shader->output[i].sid = d->Semantic.Index + j;
ctx->shader->output[i].gpr = ctx->file_offset[TGSI_FILE_OUTPUT] + d->Range.First + j;
@@ -1117,7 +1117,7 @@ static int allocate_system_value_inputs(struct r600_shader_ctx *ctx, int gpr_off
} else if (parse.FullToken.Token.Type == TGSI_TOKEN_TYPE_DECLARATION) {
struct tgsi_full_declaration *d = &parse.FullToken.FullDeclaration;
if (d->Declaration.File == TGSI_FILE_SYSTEM_VALUE) {
- for (k = 0; k < Elements(inputs); k++) {
+ for (k = 0; k < ARRAY_SIZE(inputs); k++) {
if (d->Semantic.Name == inputs[k].name ||
d->Semantic.Name == inputs[k].alternate_name) {
inputs[k].enabled = true;
@@ -1129,7 +1129,7 @@ static int allocate_system_value_inputs(struct r600_shader_ctx *ctx, int gpr_off
tgsi_parse_free(&parse);
- for (i = 0; i < Elements(inputs); i++) {
+ for (i = 0; i < ARRAY_SIZE(inputs); i++) {
boolean enabled = inputs[i].enabled;
int *reg = inputs[i].reg;
unsigned name = inputs[i].name;
@@ -1217,7 +1217,7 @@ static int evergreen_gpr_count(struct r600_shader_ctx *ctx)
/* assign gpr to each interpolator according to priority */
num_baryc = 0;
- for (i = 0; i < Elements(ctx->eg_interpolators); i++) {
+ for (i = 0; i < ARRAY_SIZE(ctx->eg_interpolators); i++) {
if (ctx->eg_interpolators[i].enabled) {
ctx->eg_interpolators[i].ij_index = num_baryc;
num_baryc ++;
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index cac240e8fba..b75f61b3065 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -121,7 +121,7 @@ static unsigned r600_conv_pipe_prim(unsigned prim)
[PIPE_PRIM_PATCHES] = V_008958_DI_PT_PATCH,
[R600_PRIM_RECTANGLE_LIST] = V_008958_DI_PT_RECTLIST
};
- assert(prim < Elements(prim_conv));
+ assert(prim < ARRAY_SIZE(prim_conv));
return prim_conv[prim];
}
@@ -145,7 +145,7 @@ unsigned r600_conv_prim_to_gs_out(unsigned mode)
[PIPE_PRIM_PATCHES] = V_028A6C_OUTPRIM_TYPE_POINTLIST,
[R600_PRIM_RECTANGLE_LIST] = V_028A6C_OUTPRIM_TYPE_TRISTRIP
};
- assert(mode < Elements(prim_conv));
+ assert(mode < ARRAY_SIZE(prim_conv));
return prim_conv[mode];
}
@@ -1283,7 +1283,7 @@ void r600_set_sample_locations_constant_buffer(struct r600_context *rctx)
struct pipe_context *ctx = &rctx->b.b;
assert(rctx->framebuffer.nr_samples < R600_UCP_SIZE);
- assert(rctx->framebuffer.nr_samples <= Elements(rctx->sample_positions)/4);
+ assert(rctx->framebuffer.nr_samples <= ARRAY_SIZE(rctx->sample_positions)/4);
memset(rctx->sample_positions, 0, 4 * 4 * 16);
for (i = 0; i < rctx->framebuffer.nr_samples; i++) {
diff --git a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
index 0983974ab5d..ae92a767b4c 100644
--- a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
+++ b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
@@ -176,7 +176,7 @@ int bc_parser::parse_decls() {
if (ps_interp) {
/* add the egcm ij interpolators to live inputs */
unsigned num_ij = 0;
- for (unsigned i = 0; i < Elements(ij_interpolators); i++) {
+ for (unsigned i = 0; i < ARRAY_SIZE(ij_interpolators); i++) {
num_ij += ij_interpolators[i];
}
diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
index 9f12ccd278c..e3626144ddd 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -1174,11 +1174,11 @@ static struct pipe_driver_query_info r600_driver_query_list[] = {
static unsigned r600_get_num_queries(struct r600_common_screen *rscreen)
{
if (rscreen->info.drm_major == 2 && rscreen->info.drm_minor >= 42)
- return Elements(r600_driver_query_list);
+ return ARRAY_SIZE(r600_driver_query_list);
else if (rscreen->info.drm_major == 3)
- return Elements(r600_driver_query_list) - 3;
+ return ARRAY_SIZE(r600_driver_query_list) - 3;
else
- return Elements(r600_driver_query_list) - 4;
+ return ARRAY_SIZE(r600_driver_query_list) - 4;
}
static int r600_get_driver_query_info(struct pipe_screen *screen,
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index 773d67a2f04..c89afbc6d76 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -313,7 +313,7 @@ static int r600_setup_surface(struct pipe_screen *screen,
}
if (offset) {
- for (i = 0; i < Elements(rtex->surface.level); ++i)
+ for (i = 0; i < ARRAY_SIZE(rtex->surface.level); ++i)
rtex->surface.level[i].offset += offset;
}
return 0;
diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index dd86f661a17..74b36ece212 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -1341,7 +1341,7 @@ static void emit_lsb(const struct lp_build_tgsi_action * action,
emit_data->output[emit_data->chan] =
lp_build_intrinsic(gallivm->builder, "llvm.cttz.i32",
- emit_data->dst_type, args, Elements(args),
+ emit_data->dst_type, args, ARRAY_SIZE(args),
LLVMReadNoneAttribute);
}
@@ -1360,7 +1360,7 @@ static void emit_umsb(const struct lp_build_tgsi_action * action,
LLVMValueRef msb =
lp_build_intrinsic(builder, "llvm.ctlz.i32",
- emit_data->dst_type, args, Elements(args),
+ emit_data->dst_type, args, ARRAY_SIZE(args),
LLVMReadNoneAttribute);
/* The HW returns the last bit index from MSB, but TGSI wants
diff --git a/src/gallium/drivers/radeon/radeon_video.c b/src/gallium/drivers/radeon/radeon_video.c
index acbf79005f4..da65ce8c67c 100644
--- a/src/gallium/drivers/radeon/radeon_video.c
+++ b/src/gallium/drivers/radeon/radeon_video.c
@@ -165,7 +165,7 @@ void rvid_join_surfaces(struct radeon_winsys* ws,
/* adjust the texture layer offsets */
off = align(off, surfaces[i]->bo_alignment);
- for (j = 0; j < Elements(surfaces[i]->level); ++j)
+ for (j = 0; j < ARRAY_SIZE(surfaces[i]->level); ++j)
surfaces[i]->level[j].offset += off;
off += surfaces[i]->bo_size;
}
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index b48160555f0..855b79e9f99 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -254,7 +254,7 @@ static void si_release_sampler_views(struct si_sampler_views *views)
{
int i;
- for (i = 0; i < Elements(views->views); i++) {
+ for (i = 0; i < ARRAY_SIZE(views->views); i++) {
pipe_sampler_view_reference(&views->views[i], NULL);
}
si_release_descriptors(&views->desc);
@@ -673,7 +673,7 @@ static void si_vertex_buffers_begin_new_cs(struct si_context *sctx)
for (i = 0; i < count; i++) {
int vb = sctx->vertex_elements->elements[i].vertex_buffer_index;
- if (vb >= Elements(sctx->vertex_buffer))
+ if (vb >= ARRAY_SIZE(sctx->vertex_buffer))
continue;
if (!sctx->vertex_buffer[vb].buffer)
continue;
@@ -725,7 +725,7 @@ static bool si_upload_vertex_buffer_descriptors(struct si_context *sctx)
unsigned offset;
uint32_t *desc = &ptr[i*4];
- if (ve->vertex_buffer_index >= Elements(sctx->vertex_buffer)) {
+ if (ve->vertex_buffer_index >= ARRAY_SIZE(sctx->vertex_buffer)) {
memset(desc, 0, 16);
continue;
}
@@ -1219,7 +1219,7 @@ static void si_invalidate_buffer(struct pipe_context *ctx, struct pipe_resource
for (i = 0; i < num_elems; i++) {
int vb = sctx->vertex_elements->elements[i].vertex_buffer_index;
- if (vb >= Elements(sctx->vertex_buffer))
+ if (vb >= ARRAY_SIZE(sctx->vertex_buffer))
continue;
if (!sctx->vertex_buffer[vb].buffer)
continue;
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 1f6cbf7d857..74121946a7a 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -58,7 +58,7 @@ static void si_destroy_context(struct pipe_context *context)
si_pm4_free_state(sctx, sctx->init_config, ~0);
if (sctx->init_config_gs_rings)
si_pm4_free_state(sctx, sctx->init_config_gs_rings, ~0);
- for (i = 0; i < Elements(sctx->vgt_shader_config); i++)
+ for (i = 0; i < ARRAY_SIZE(sctx->vgt_shader_config); i++)
si_pm4_delete_state(sctx, vgt_shader_config, sctx->vgt_shader_config[i]);
if (sctx->fixed_func_tcs_shader.cso)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 448c14554be..c0b9705b183 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1876,7 +1876,7 @@ static void build_tbuffer_store(struct si_shader_context *ctx,
snprintf(name, sizeof(name), "llvm.SI.tbuffer.store.%s", types[func]);
lp_build_intrinsic(gallivm->builder, name, ctx->voidt,
- args, Elements(args), 0);
+ args, ARRAY_SIZE(args), 0);
}
static void build_tbuffer_store_dwords(struct si_shader_context *ctx,
@@ -5155,7 +5155,7 @@ static void create_function(struct si_shader_context *ctx)
return;
}
- assert(num_params <= Elements(params));
+ assert(num_params <= ARRAY_SIZE(params));
si_create_function(ctx, returns, num_returns, params,
num_params, last_array_pointer, last_sgpr);
@@ -5918,7 +5918,7 @@ void si_dump_shader_key(unsigned shader, union si_shader_key *key, FILE *f)
switch (shader) {
case PIPE_SHADER_VERTEX:
fprintf(f, " instance_divisors = {");
- for (i = 0; i < Elements(key->vs.prolog.instance_divisors); i++)
+ for (i = 0; i < ARRAY_SIZE(key->vs.prolog.instance_divisors); i++)
fprintf(f, !i ? "%u" : ", %u",
key->vs.prolog.instance_divisors[i]);
fprintf(f, "}\n");
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 8eb2b3dd6b0..85d8509f1c8 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -3179,7 +3179,7 @@ static void si_set_vertex_buffers(struct pipe_context *ctx,
struct pipe_vertex_buffer *dst = sctx->vertex_buffer + start_slot;
int i;
- assert(start_slot + count <= Elements(sctx->vertex_buffer));
+ assert(start_slot + count <= ARRAY_SIZE(sctx->vertex_buffer));
if (buffers) {
for (i = 0; i < count; i++) {
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 9b52566d793..dab0dcce03b 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -54,7 +54,7 @@ static unsigned si_conv_pipe_prim(unsigned mode)
[PIPE_PRIM_PATCHES] = V_008958_DI_PT_PATCH,
[R600_PRIM_RECTANGLE_LIST] = V_008958_DI_PT_RECTLIST
};
- assert(mode < Elements(prim_conv));
+ assert(mode < ARRAY_SIZE(prim_conv));
return prim_conv[mode];
}
@@ -78,7 +78,7 @@ static unsigned si_conv_prim_to_gs_out(unsigned mode)
[PIPE_PRIM_PATCHES] = V_028A6C_OUTPRIM_TYPE_POINTLIST,
[R600_PRIM_RECTANGLE_LIST] = V_028A6C_OUTPRIM_TYPE_TRISTRIP
};
- assert(mode < Elements(prim_conv));
+ assert(mode < ARRAY_SIZE(prim_conv));
return prim_conv[mode];
}