summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2016-04-25 09:34:40 -0600
committerBrian Paul <brianp@vmware.com>2016-04-25 12:59:29 -0600
commite0184b3995fa308c125ae8e090d2bbdffd495b5f (patch)
treef859ac4b8bd85d3b1fc7bc926d2b7f11d87a8402 /src
parent77e4b41671ecd7bde3a151627d4548106fc5be3c (diff)
svga: s/Elements/ARRAY_SIZE/
Standardize on the later macro rather than a mix of both. Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/svga/svga_cmd_vgpu10.c2
-rw-r--r--src/gallium/drivers/svga/svga_context.c6
-rw-r--r--src/gallium/drivers/svga/svga_format.c20
-rw-r--r--src/gallium/drivers/svga/svga_link.c6
-rw-r--r--src/gallium/drivers/svga/svga_pipe_constants.c2
-rw-r--r--src/gallium/drivers/svga/svga_pipe_sampler.c2
-rw-r--r--src/gallium/drivers/svga/svga_pipe_vs.c2
-rw-r--r--src/gallium/drivers/svga/svga_resource_texture.h2
-rw-r--r--src/gallium/drivers/svga/svga_sampler_view.c2
-rw-r--r--src/gallium/drivers/svga/svga_screen.c4
-rw-r--r--src/gallium/drivers/svga/svga_shader.c2
-rw-r--r--src/gallium/drivers/svga/svga_state_constants.c2
-rw-r--r--src/gallium/drivers/svga/svga_state_rss.c4
-rw-r--r--src/gallium/drivers/svga/svga_state_sampler.c2
-rw-r--r--src/gallium/drivers/svga/svga_state_tss.c10
-rw-r--r--src/gallium/drivers/svga/svga_swtnl_draw.c4
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_decl_sm30.c8
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_insn.c10
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_vgpu10.c20
19 files changed, 55 insertions, 55 deletions
diff --git a/src/gallium/drivers/svga/svga_cmd_vgpu10.c b/src/gallium/drivers/svga/svga_cmd_vgpu10.c
index 99c9add1743..2729655ef47 100644
--- a/src/gallium/drivers/svga/svga_cmd_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_cmd_vgpu10.c
@@ -1112,7 +1112,7 @@ SVGA3D_vgpu10_DefineStreamOutput(struct svga_winsys_context *swc,
cmd->soid = soid;
cmd->numOutputStreamEntries = numOutputStreamEntries;
- for (i = 0; i < Elements(cmd->streamOutputStrideInBytes); i++)
+ for (i = 0; i < ARRAY_SIZE(cmd->streamOutputStrideInBytes); i++)
cmd->streamOutputStrideInBytes[i] = streamOutputStrideInBytes[i];
memcpy(cmd->decl, decl,
diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
index 896dcdf59d0..32dc209b619 100644
--- a/src/gallium/drivers/svga/svga_context.c
+++ b/src/gallium/drivers/svga/svga_context.c
@@ -61,7 +61,7 @@ static void svga_destroy( struct pipe_context *pipe )
unsigned shader, i;
/* free any alternate rasterizer states used for point sprite */
- for (i = 0; i < Elements(svga->rasterizer_no_cull); i++) {
+ for (i = 0; i < ARRAY_SIZE(svga->rasterizer_no_cull); i++) {
if (svga->rasterizer_no_cull[i]) {
pipe->delete_rasterizer_state(pipe, svga->rasterizer_no_cull[i]);
}
@@ -78,7 +78,7 @@ static void svga_destroy( struct pipe_context *pipe )
pipe_resource_reference(&svga->polygon_stipple.texture, NULL);
/* free HW constant buffers */
- for (shader = 0; shader < Elements(svga->state.hw_draw.constbuf); shader++) {
+ for (shader = 0; shader < ARRAY_SIZE(svga->state.hw_draw.constbuf); shader++) {
pipe_resource_reference(&svga->state.hw_draw.constbuf[shader], NULL);
}
@@ -116,7 +116,7 @@ static void svga_destroy( struct pipe_context *pipe )
/* free user's constant buffers */
for (shader = 0; shader < PIPE_SHADER_TYPES; ++shader) {
- for (i = 0; i < Elements(svga->curr.constbufs[shader]); ++i) {
+ for (i = 0; i < ARRAY_SIZE(svga->curr.constbufs[shader]); ++i) {
pipe_resource_reference(&svga->curr.constbufs[shader][i].buffer, NULL);
}
}
diff --git a/src/gallium/drivers/svga/svga_format.c b/src/gallium/drivers/svga/svga_format.c
index 0186736c85e..2fc920add64 100644
--- a/src/gallium/drivers/svga/svga_format.c
+++ b/src/gallium/drivers/svga/svga_format.c
@@ -366,8 +366,8 @@ svga_translate_vertex_format_vgpu10(enum pipe_format format,
SVGA3dSurfaceFormat *svga_format,
unsigned *vf_flags)
{
- assert(format < Elements(format_conversion_table));
- if (format >= Elements(format_conversion_table)) {
+ assert(format < ARRAY_SIZE(format_conversion_table));
+ if (format >= ARRAY_SIZE(format_conversion_table)) {
format = PIPE_FORMAT_NONE;
}
*svga_format = format_conversion_table[format].vertex_format;
@@ -1838,13 +1838,13 @@ check_format_tables(void)
if (first_call) {
unsigned i;
- STATIC_ASSERT(Elements(format_cap_table) == SVGA3D_FORMAT_MAX);
- for (i = 0; i < Elements(format_cap_table); i++) {
+ STATIC_ASSERT(ARRAY_SIZE(format_cap_table) == SVGA3D_FORMAT_MAX);
+ for (i = 0; i < ARRAY_SIZE(format_cap_table); i++) {
assert(format_cap_table[i].format == i);
}
- STATIC_ASSERT(Elements(format_conversion_table) == PIPE_FORMAT_COUNT);
- for (i = 0; i < Elements(format_conversion_table); i++) {
+ STATIC_ASSERT(ARRAY_SIZE(format_conversion_table) == PIPE_FORMAT_COUNT);
+ for (i = 0; i < ARRAY_SIZE(format_conversion_table); i++) {
assert(format_conversion_table[i].pformat == i);
}
@@ -1873,7 +1873,7 @@ svga_get_format_cap(struct svga_screen *ss,
(void) check_format_tables;
#endif
- assert(format < Elements(format_cap_table));
+ assert(format < ARRAY_SIZE(format_cap_table));
entry = &format_cap_table[format];
assert(entry->format == format);
@@ -1912,7 +1912,7 @@ svga_format_size(SVGA3dSurfaceFormat format,
unsigned *block_height,
unsigned *bytes_per_block)
{
- assert(format < Elements(format_cap_table));
+ assert(format < ARRAY_SIZE(format_cap_table));
*block_width = format_cap_table[format].block_width;
*block_height = format_cap_table[format].block_height;
*bytes_per_block = format_cap_table[format].block_bytes;
@@ -1928,7 +1928,7 @@ svga_format_size(SVGA3dSurfaceFormat format,
const char *
svga_format_name(SVGA3dSurfaceFormat format)
{
- assert(format < Elements(format_cap_table));
+ assert(format < ARRAY_SIZE(format_cap_table));
return format_cap_table[format].name;
}
@@ -1970,7 +1970,7 @@ svga_format_is_integer(SVGA3dSurfaceFormat format)
boolean
svga_format_support_gen_mips(enum pipe_format format)
{
- assert(format < Elements(format_conversion_table));
+ assert(format < ARRAY_SIZE(format_conversion_table));
return ((format_conversion_table[format].flags & TF_GEN_MIPS) > 0);
}
diff --git a/src/gallium/drivers/svga/svga_link.c b/src/gallium/drivers/svga/svga_link.c
index f3e524d38ea..0aaaada4c60 100644
--- a/src/gallium/drivers/svga/svga_link.c
+++ b/src/gallium/drivers/svga/svga_link.c
@@ -45,7 +45,7 @@ svga_link_shaders(const struct tgsi_shader_info *outshader_info,
{
unsigned i, free_slot;
- for (i = 0; i < Elements(linkage->input_map); i++) {
+ for (i = 0; i < ARRAY_SIZE(linkage->input_map); i++) {
linkage->input_map[i] = INVALID_INDEX;
}
@@ -55,7 +55,7 @@ svga_link_shaders(const struct tgsi_shader_info *outshader_info,
* We'll modify the input shader's inputs to match the output shader.
*/
assert(inshader_info->num_inputs <=
- Elements(inshader_info->input_semantic_name));
+ ARRAY_SIZE(inshader_info->input_semantic_name));
/* free register index that can be used for built-in varyings */
free_slot = outshader_info->num_outputs + 1;
@@ -76,7 +76,7 @@ svga_link_shaders(const struct tgsi_shader_info *outshader_info,
else {
/* search output shader outputs for same item */
for (j = 0; j < outshader_info->num_outputs; j++) {
- assert(j < Elements(outshader_info->output_semantic_name));
+ assert(j < ARRAY_SIZE(outshader_info->output_semantic_name));
if (outshader_info->output_semantic_name[j] == sem_name &&
outshader_info->output_semantic_index[j] == sem_index) {
linkage->input_map[i] = j;
diff --git a/src/gallium/drivers/svga/svga_pipe_constants.c b/src/gallium/drivers/svga/svga_pipe_constants.c
index 8150879ea13..204b13c9b13 100644
--- a/src/gallium/drivers/svga/svga_pipe_constants.c
+++ b/src/gallium/drivers/svga/svga_pipe_constants.c
@@ -64,7 +64,7 @@ static void svga_set_constant_buffer(struct pipe_context *pipe,
}
assert(shader < PIPE_SHADER_TYPES);
- assert(index < Elements(svga->curr.constbufs[shader]));
+ assert(index < ARRAY_SIZE(svga->curr.constbufs[shader]));
assert(index < svgascreen->max_const_buffers);
(void) svgascreen;
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index 52c8a81af6d..0780c95ad9c 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -425,7 +425,7 @@ svga_set_sampler_views(struct pipe_context *pipe,
boolean any_change = FALSE;
assert(shader < PIPE_SHADER_TYPES);
- assert(start + num <= Elements(svga->curr.sampler_views[shader]));
+ assert(start + num <= ARRAY_SIZE(svga->curr.sampler_views[shader]));
/* Pre-VGPU10 only supports FS textures */
if (!svga_have_vgpu10(svga) && shader != PIPE_SHADER_FRAGMENT)
diff --git a/src/gallium/drivers/svga/svga_pipe_vs.c b/src/gallium/drivers/svga/svga_pipe_vs.c
index 630f4907895..50cd0ac9a11 100644
--- a/src/gallium/drivers/svga/svga_pipe_vs.c
+++ b/src/gallium/drivers/svga/svga_pipe_vs.c
@@ -80,7 +80,7 @@ substitute_vs(unsigned shader_id, const struct tgsi_token *old_tokens)
if (!tgsi_text_translate(text,
tokens,
- Elements(tokens)))
+ ARRAY_SIZE(tokens)))
{
assert(0);
return NULL;
diff --git a/src/gallium/drivers/svga/svga_resource_texture.h b/src/gallium/drivers/svga/svga_resource_texture.h
index 99ba33b2677..283b87fa780 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.h
+++ b/src/gallium/drivers/svga/svga_resource_texture.h
@@ -136,7 +136,7 @@ svga_transfer(struct pipe_transfer *transfer)
static inline void
svga_age_texture_view(struct svga_texture *tex, unsigned level)
{
- assert(level < Elements(tex->view_age));
+ assert(level < ARRAY_SIZE(tex->view_age));
tex->view_age[level] = ++(tex->age);
}
diff --git a/src/gallium/drivers/svga/svga_sampler_view.c b/src/gallium/drivers/svga/svga_sampler_view.c
index 9c33a79db0f..d43f8ccf2d3 100644
--- a/src/gallium/drivers/svga/svga_sampler_view.c
+++ b/src/gallium/drivers/svga/svga_sampler_view.c
@@ -200,7 +200,7 @@ svga_validate_sampler_view(struct svga_context *svga,
for (i = v->min_lod; i <= v->max_lod; i++) {
for (k = 0; k < numFaces; k++) {
- assert(i < Elements(tex->view_age));
+ assert(i < ARRAY_SIZE(tex->view_age));
if (v->age < tex->view_age[i])
svga_texture_copy_handle(svga,
tex->handle, 0, 0, 0, i, k,
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index 010d94b1b58..69e625f8c88 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -867,9 +867,9 @@ svga_get_driver_query_info(struct pipe_screen *screen,
#undef QUERY
if (!info)
- return Elements(queries);
+ return ARRAY_SIZE(queries);
- if (index >= Elements(queries))
+ if (index >= ARRAY_SIZE(queries))
return 0;
*info = queries[index];
diff --git a/src/gallium/drivers/svga/svga_shader.c b/src/gallium/drivers/svga/svga_shader.c
index d56cce49de5..abfef0f1044 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -171,7 +171,7 @@ svga_init_shader_key_common(const struct svga_context *svga, unsigned shader,
{
unsigned i, idx = 0;
- assert(shader < Elements(svga->curr.num_sampler_views));
+ assert(shader < ARRAY_SIZE(svga->curr.num_sampler_views));
for (i = 0; i < svga->curr.num_sampler_views[shader]; i++) {
struct pipe_sampler_view *view = svga->curr.sampler_views[shader][i];
diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c
index 5ae0382cd45..51f393f9b0c 100644
--- a/src/gallium/drivers/svga/svga_state_constants.c
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -518,7 +518,7 @@ emit_consts_vgpu9(struct svga_context *svga, unsigned shader)
assert(variant);
offset = variant->shader->info.file_max[TGSI_FILE_CONSTANT] + 1;
- assert(count <= Elements(extras));
+ assert(count <= ARRAY_SIZE(extras));
if (count > 0) {
if (ss->hw_version >= SVGA3D_HWVERSION_WS8_B1) {
diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c
index 317b44eef00..e22268d5b8f 100644
--- a/src/gallium/drivers/svga/svga_state_rss.c
+++ b/src/gallium/drivers/svga/svga_state_rss.c
@@ -47,7 +47,7 @@ struct rs_queue {
#define EMIT_RS(svga, value, token, fail) \
do { \
- STATIC_ASSERT(SVGA3D_RS_##token < Elements(svga->state.hw_draw.rs)); \
+ STATIC_ASSERT(SVGA3D_RS_##token < ARRAY_SIZE(svga->state.hw_draw.rs)); \
if (svga->state.hw_draw.rs[SVGA3D_RS_##token] != value) { \
svga_queue_rs( &queue, SVGA3D_RS_##token, value ); \
svga->state.hw_draw.rs[SVGA3D_RS_##token] = value; \
@@ -57,7 +57,7 @@ do { \
#define EMIT_RS_FLOAT(svga, fvalue, token, fail) \
do { \
unsigned value = fui(fvalue); \
- STATIC_ASSERT(SVGA3D_RS_##token < Elements(svga->state.hw_draw.rs)); \
+ STATIC_ASSERT(SVGA3D_RS_##token < ARRAY_SIZE(svga->state.hw_draw.rs)); \
if (svga->state.hw_draw.rs[SVGA3D_RS_##token] != value) { \
svga_queue_rs( &queue, SVGA3D_RS_##token, value ); \
svga->state.hw_draw.rs[SVGA3D_RS_##token] = value; \
diff --git a/src/gallium/drivers/svga/svga_state_sampler.c b/src/gallium/drivers/svga/svga_state_sampler.c
index 6179a797fa2..6e78825954f 100644
--- a/src/gallium/drivers/svga/svga_state_sampler.c
+++ b/src/gallium/drivers/svga/svga_state_sampler.c
@@ -226,7 +226,7 @@ update_sampler_resources(struct svga_context *svga, unsigned dirty)
surfaces[i] = surface;
}
- for (; i < Elements(ids); i++) {
+ for (; i < ARRAY_SIZE(ids); i++) {
ids[i] = SVGA3D_INVALID_ID;
surfaces[i] = NULL;
}
diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c
index fd6d1ce84b4..b5272d23fc1 100644
--- a/src/gallium/drivers/svga/svga_state_tss.c
+++ b/src/gallium/drivers/svga/svga_state_tss.c
@@ -44,7 +44,7 @@ void svga_cleanup_tss_binding(struct svga_context *svga)
const unsigned shader = PIPE_SHADER_FRAGMENT;
unsigned i;
- for (i = 0; i < Elements(svga->state.hw_draw.views); i++) {
+ for (i = 0; i < ARRAY_SIZE(svga->state.hw_draw.views); i++) {
struct svga_hw_view_state *view = &svga->state.hw_draw.views[i];
if (view) {
svga_sampler_view_reference(&view->v, NULL);
@@ -326,8 +326,8 @@ svga_queue_tss( struct ts_queue *q,
#define EMIT_TS(svga, unit, val, token) \
do { \
- assert(unit < Elements(svga->state.hw_draw.ts)); \
- STATIC_ASSERT(SVGA3D_TS_##token < Elements(svga->state.hw_draw.ts[unit])); \
+ assert(unit < ARRAY_SIZE(svga->state.hw_draw.ts)); \
+ STATIC_ASSERT(SVGA3D_TS_##token < ARRAY_SIZE(svga->state.hw_draw.ts[unit])); \
if (svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] != val) { \
svga_queue_tss( queue, unit, SVGA3D_TS_##token, val ); \
svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] = val; \
@@ -337,8 +337,8 @@ do { \
#define EMIT_TS_FLOAT(svga, unit, fvalue, token) \
do { \
unsigned val = fui(fvalue); \
- assert(unit < Elements(svga->state.hw_draw.ts)); \
- STATIC_ASSERT(SVGA3D_TS_##token < Elements(svga->state.hw_draw.ts[unit])); \
+ assert(unit < ARRAY_SIZE(svga->state.hw_draw.ts)); \
+ STATIC_ASSERT(SVGA3D_TS_##token < ARRAY_SIZE(svga->state.hw_draw.ts[unit])); \
if (svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] != val) { \
svga_queue_tss( queue, unit, SVGA3D_TS_##token, val ); \
svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] = val; \
diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c
index 6a8e857cee8..67d1fae9d1a 100644
--- a/src/gallium/drivers/svga/svga_swtnl_draw.c
+++ b/src/gallium/drivers/svga/svga_swtnl_draw.c
@@ -90,7 +90,7 @@ svga_swtnl_draw_vbo(struct svga_context *svga,
}
/* Map constant buffers */
- for (i = 0; i < Elements(svga->curr.constbufs[PIPE_SHADER_VERTEX]); ++i) {
+ for (i = 0; i < ARRAY_SIZE(svga->curr.constbufs[PIPE_SHADER_VERTEX]); ++i) {
if (svga->curr.constbufs[PIPE_SHADER_VERTEX][i].buffer == NULL) {
continue;
}
@@ -128,7 +128,7 @@ svga_swtnl_draw_vbo(struct svga_context *svga,
draw_set_indexes(draw, NULL, 0, 0);
}
- for (i = 0; i < Elements(svga->curr.constbufs[PIPE_SHADER_VERTEX]); ++i) {
+ for (i = 0; i < ARRAY_SIZE(svga->curr.constbufs[PIPE_SHADER_VERTEX]); ++i) {
if (svga->curr.constbufs[PIPE_SHADER_VERTEX][i].buffer) {
pipe_buffer_unmap(&svga->pipe, cb_transfer[i]);
}
diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
index 418f898e0e3..42a3593ed2a 100644
--- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
@@ -118,7 +118,7 @@ emit_decl(struct svga_shader_emitter *emit,
dcl.values[0] |= 1<<31;
return (emit_instruction(emit, opcode) &&
- svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
+ svga_shader_emit_dwords( emit, dcl.values, ARRAY_SIZE(dcl.values)));
}
@@ -410,7 +410,7 @@ vs30_input(struct svga_shader_emitter *emit,
dcl.values[0] |= 1<<31;
return (emit_instruction(emit, opcode) &&
- svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
+ svga_shader_emit_dwords( emit, dcl.values, ARRAY_SIZE(dcl.values)));
}
@@ -509,7 +509,7 @@ vs30_output(struct svga_shader_emitter *emit,
}
return (emit_instruction(emit, opcode) &&
- svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
+ svga_shader_emit_dwords( emit, dcl.values, ARRAY_SIZE(dcl.values)));
}
@@ -549,7 +549,7 @@ ps30_sampler( struct svga_shader_emitter *emit,
dcl.values[0] |= 1<<31;
return (emit_instruction(emit, opcode) &&
- svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
+ svga_shader_emit_dwords( emit, dcl.values, ARRAY_SIZE(dcl.values)));
}
boolean
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c
index f0ef65f3d71..a7fa6a22dec 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -767,7 +767,7 @@ emit_def_const(struct svga_shader_emitter *emit,
}
if (!emit_instruction(emit, opcode) ||
- !svga_shader_emit_dwords( emit, def.values, Elements(def.values)))
+ !svga_shader_emit_dwords( emit, def.values, ARRAY_SIZE(def.values)))
return FALSE;
return TRUE;
@@ -2866,7 +2866,7 @@ emit_call(struct svga_shader_emitter *emit,
break;
}
- if (emit->nr_labels == Elements(emit->label))
+ if (emit->nr_labels == ARRAY_SIZE(emit->label))
return FALSE;
if (i == emit->nr_labels) {
@@ -3487,12 +3487,12 @@ emit_inverted_texcoords(struct svga_shader_emitter *emit)
assert(emit->inverted_texcoords & (1 << unit));
- assert(unit < Elements(emit->ps_true_texcoord));
+ assert(unit < ARRAY_SIZE(emit->ps_true_texcoord));
- assert(unit < Elements(emit->ps_inverted_texcoord_input));
+ assert(unit < ARRAY_SIZE(emit->ps_inverted_texcoord_input));
assert(emit->ps_inverted_texcoord_input[unit]
- < Elements(emit->input_map));
+ < ARRAY_SIZE(emit->input_map));
/* inverted = coord * (1, -1, 1, 1) + (0, 1, 0, 0) */
if (!submit_op3(emit,
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index a899c47cd7f..8639333707f 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -1022,7 +1022,7 @@ emit_src_register(struct svga_shader_emitter_v10 *emit,
}
}
else if (file == TGSI_FILE_SYSTEM_VALUE) {
- assert(index < Elements(emit->system_value_indexes));
+ assert(index < ARRAY_SIZE(emit->system_value_indexes));
index = emit->system_value_indexes[index];
}
}
@@ -1078,7 +1078,7 @@ emit_src_register(struct svga_shader_emitter_v10 *emit,
if (operand0.operandType == VGPU10_OPERAND_TYPE_IMMEDIATE32) {
/* Emit the four float/int in-line immediate values */
unsigned *c;
- assert(index < Elements(emit->immediates));
+ assert(index < ARRAY_SIZE(emit->immediates));
assert(file == TGSI_FILE_IMMEDIATE);
assert(swizzleX < 4);
assert(swizzleY < 4);
@@ -1735,7 +1735,7 @@ alloc_immediate_4(struct svga_shader_emitter_v10 *emit,
{
unsigned n = emit->num_immediates++;
assert(!emit->immediates_emitted);
- assert(n < Elements(emit->immediates));
+ assert(n < ARRAY_SIZE(emit->immediates));
emit->immediates[n][0] = imm[0];
emit->immediates[n][1] = imm[1];
emit->immediates[n][2] = imm[2];
@@ -1785,7 +1785,7 @@ static unsigned
alloc_system_value_index(struct svga_shader_emitter_v10 *emit, unsigned index)
{
const unsigned n = emit->info.file_max[TGSI_FILE_INPUT] + 1 + index;
- assert(index < Elements(emit->system_value_indexes));
+ assert(index < ARRAY_SIZE(emit->system_value_indexes));
emit->system_value_indexes[index] = n;
return n;
}
@@ -1922,14 +1922,14 @@ emit_vgpu10_property(struct svga_shader_emitter_v10 *emit,
switch (prop->Property.PropertyName) {
case TGSI_PROPERTY_GS_INPUT_PRIM:
- assert(prop->u[0].Data < Elements(primType));
+ assert(prop->u[0].Data < ARRAY_SIZE(primType));
emit->gs.prim_type = primType[prop->u[0].Data];
assert(emit->gs.prim_type != VGPU10_PRIMITIVE_UNDEFINED);
emit->gs.input_size = inputArraySize[emit->gs.prim_type];
break;
case TGSI_PROPERTY_GS_OUTPUT_PRIM:
- assert(prop->u[0].Data < Elements(primTopology));
+ assert(prop->u[0].Data < ARRAY_SIZE(primTopology));
emit->gs.prim_topology = primTopology[prop->u[0].Data];
assert(emit->gs.prim_topology != VGPU10_PRIMITIVE_TOPOLOGY_UNDEFINED);
break;
@@ -2269,7 +2269,7 @@ emit_vgpu10_declaration(struct svga_shader_emitter_v10 *emit,
* have linked due to constbuf index out of bounds, so we shouldn't
* have reached here.
*/
- assert(constbuf < Elements(emit->num_shader_consts));
+ assert(constbuf < ARRAY_SIZE(emit->num_shader_consts));
num_consts = MAX2(emit->num_shader_consts[constbuf],
decl->Range.Last + 1);
@@ -2490,7 +2490,7 @@ emit_output_declarations(struct svga_shader_emitter_v10 *emit)
if (emit->unit == PIPE_SHADER_FRAGMENT) {
if (semantic_name == TGSI_SEMANTIC_COLOR) {
- assert(semantic_index < Elements(emit->fs.color_out_index));
+ assert(semantic_index < ARRAY_SIZE(emit->fs.color_out_index));
emit->fs.color_out_index[semantic_index] = index;
@@ -2875,7 +2875,7 @@ emit_constant_declaration(struct svga_shader_emitter_v10 *emit)
}
/* Declare remaining constant buffers (UBOs) */
- for (i = 1; i < Elements(emit->num_shader_consts); i++) {
+ for (i = 1; i < ARRAY_SIZE(emit->num_shader_consts); i++) {
if (emit->num_shader_consts[i] > 0) {
begin_emit_instruction(emit);
emit_dword(emit, opcode0.value);
@@ -6295,7 +6295,7 @@ alloc_common_immediates(struct svga_shader_emitter_v10 *emit)
alloc_immediate_int4(emit, 22, 30, 0, 0);
}
- assert(n <= Elements(emit->common_immediate_pos));
+ assert(n <= ARRAY_SIZE(emit->common_immediate_pos));
emit->num_common_immediates = n;
}