summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
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/state_trackers
parent322cd2457ccf66a0a88d92f0b0dec1cb3f93eae4 (diff)
Treewide: Remove Elements() macro
Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/clover/tgsi/compiler.cpp2
-rw-r--r--src/gallium/state_trackers/nine/device9.c10
-rw-r--r--src/gallium/state_trackers/nine/nine_ff.c6
-rw-r--r--src/gallium/state_trackers/nine/nine_shader.c64
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c8
-rw-r--r--src/gallium/state_trackers/nine/stateblock9.c6
-rw-r--r--src/gallium/state_trackers/nine/vertexshader9.c2
-rw-r--r--src/gallium/state_trackers/omx/vid_dec_h264.c4
-rw-r--r--src/gallium/state_trackers/osmesa/osmesa.c4
-rw-r--r--src/gallium/state_trackers/va/surface.c4
-rw-r--r--src/gallium/state_trackers/vdpau/ftab.c6
-rw-r--r--src/gallium/state_trackers/wgl/stw_pixelformat.c10
12 files changed, 63 insertions, 63 deletions
diff --git a/src/gallium/state_trackers/clover/tgsi/compiler.cpp b/src/gallium/state_trackers/clover/tgsi/compiler.cpp
index 4d056668a22..dc5ae1a9c76 100644
--- a/src/gallium/state_trackers/clover/tgsi/compiler.cpp
+++ b/src/gallium/state_trackers/clover/tgsi/compiler.cpp
@@ -83,7 +83,7 @@ namespace {
read_body(const char *source, module &m, std::string &r_log) {
tgsi_token prog[1024];
- if (!tgsi_text_translate(source, prog, Elements(prog))) {
+ if (!tgsi_text_translate(source, prog, ARRAY_SIZE(prog))) {
r_log = "translate failed";
throw compile_error();
}
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 74ba3040ce4..1a345b93d3c 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2659,8 +2659,8 @@ NineDevice9_GetTextureStageState( struct NineDevice9 *This,
{
const struct nine_state *state = &This->state;
- user_assert(Stage < Elements(state->ff.tex_stage), D3DERR_INVALIDCALL);
- user_assert(Type < Elements(state->ff.tex_stage[0]), D3DERR_INVALIDCALL);
+ user_assert(Stage < ARRAY_SIZE(state->ff.tex_stage), D3DERR_INVALIDCALL);
+ user_assert(Type < ARRAY_SIZE(state->ff.tex_stage[0]), D3DERR_INVALIDCALL);
*pValue = state->ff.tex_stage[Stage][Type];
@@ -2679,8 +2679,8 @@ NineDevice9_SetTextureStageState( struct NineDevice9 *This,
DBG("Stage=%u Type=%u Value=%08x\n", Stage, Type, Value);
nine_dump_D3DTSS_value(DBG_FF, Type, Value);
- user_assert(Stage < Elements(state->ff.tex_stage), D3DERR_INVALIDCALL);
- user_assert(Type < Elements(state->ff.tex_stage[0]), D3DERR_INVALIDCALL);
+ user_assert(Stage < ARRAY_SIZE(state->ff.tex_stage), D3DERR_INVALIDCALL);
+ user_assert(Type < ARRAY_SIZE(state->ff.tex_stage[0]), D3DERR_INVALIDCALL);
state->ff.tex_stage[Stage][Type] = Value;
switch (Type) {
@@ -2776,7 +2776,7 @@ NineDevice9_ValidateDevice( struct NineDevice9 *This,
DBG("This=%p pNumPasses=%p\n", This, pNumPasses);
- for (i = 0; i < Elements(state->samp); ++i) {
+ for (i = 0; i < ARRAY_SIZE(state->samp); ++i) {
if (state->samp[i][D3DSAMP_MINFILTER] == D3DTEXF_NONE ||
state->samp[i][D3DSAMP_MAGFILTER] == D3DTEXF_NONE)
return D3DERR_UNSUPPORTEDTEXTUREFILTER;
diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c
index 7b26c954d3f..882a951357c 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -126,7 +126,7 @@ static unsigned nine_ff_vs_key_hash(void *key)
struct nine_ff_vs_key *vs = key;
unsigned i;
uint32_t hash = vs->value32[0];
- for (i = 1; i < Elements(vs->value32); ++i)
+ for (i = 1; i < ARRAY_SIZE(vs->value32); ++i)
hash ^= vs->value32[i];
return hash;
}
@@ -142,7 +142,7 @@ static unsigned nine_ff_ps_key_hash(void *key)
struct nine_ff_ps_key *ps = key;
unsigned i;
uint32_t hash = ps->value32[0];
- for (i = 1; i < Elements(ps->value32); ++i)
+ for (i = 1; i < ARRAY_SIZE(ps->value32); ++i)
hash ^= ps->value32[i];
return hash;
}
@@ -1225,7 +1225,7 @@ nine_ff_build_ps(struct NineDevice9 *device, struct nine_ff_ps_key *key)
ps.vC[0] = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_COLOR, 0, TGSI_INTERPOLATE_COLOR);
/* Declare all TEMPs we might need, serious drivers have a register allocator. */
- for (i = 0; i < Elements(ps.r); ++i)
+ for (i = 0; i < ARRAY_SIZE(ps.r); ++i)
ps.r[i] = ureg_DECL_local_temporary(ureg);
ps.rCur = ps.r[0];
ps.rTmp = ps.r[1];
diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c
index a539ab91f60..4ad5fa1723d 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -411,12 +411,12 @@ sm1_dump_instruction(struct sm1_instruction *insn, unsigned indent)
DUMP("_co");
DUMP(" ");
- for (i = 0; i < insn->ndst && i < Elements(insn->dst); ++i) {
+ for (i = 0; i < insn->ndst && i < ARRAY_SIZE(insn->dst); ++i) {
sm1_dump_dst_param(&insn->dst[i]);
DUMP(" ");
}
- for (i = 0; i < insn->nsrc && i < Elements(insn->src); ++i) {
+ for (i = 0; i < insn->nsrc && i < ARRAY_SIZE(insn->src); ++i) {
sm1_dump_src_param(&insn->src[i]);
DUMP(" ");
}
@@ -490,7 +490,7 @@ struct shader_translator
struct ureg_src vT[8]; /* PS texcoord in */
struct ureg_dst rL[NINE_MAX_LOOP_DEPTH]; /* loop ctr */
} regs;
- unsigned num_temp; /* Elements(regs.r) */
+ unsigned num_temp; /* ARRAY_SIZE(regs.r) */
unsigned num_scratch;
unsigned loop_depth;
unsigned loop_depth_max;
@@ -622,7 +622,7 @@ tx_set_lconstb(struct shader_translator *tx, INT index, BOOL b)
static inline struct ureg_dst
tx_scratch(struct shader_translator *tx)
{
- if (tx->num_scratch >= Elements(tx->regs.t)) {
+ if (tx->num_scratch >= ARRAY_SIZE(tx->regs.t)) {
tx->failure = TRUE;
return tx->regs.t[0];
}
@@ -735,7 +735,7 @@ static inline void
tx_texcoord_alloc(struct shader_translator *tx, INT idx)
{
assert(IS_PS);
- assert(idx >= 0 && idx < Elements(tx->regs.vT));
+ assert(idx >= 0 && idx < ARRAY_SIZE(tx->regs.vT));
if (ureg_src_is_undef(tx->regs.vT[idx]))
tx->regs.vT[idx] = ureg_DECL_fs_input(tx->ureg, tx->texcoord_sn, idx,
TGSI_INTERPOLATE_PERSPECTIVE);
@@ -895,7 +895,7 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
0, 1);
} else {
assert(!param->rel); /* TODO */
- assert(param->idx < Elements(tx->regs.v));
+ assert(param->idx < ARRAY_SIZE(tx->regs.v));
src = tx->regs.v[param->idx];
}
}
@@ -1165,7 +1165,7 @@ _tx_dst_param(struct shader_translator *tx, const struct sm1_dst_param *param)
dst = ureg_DECL_output(tx->ureg, tx->texcoord_sn, param->idx);
} else {
assert(!param->rel); /* TODO */
- assert(param->idx < Elements(tx->regs.o));
+ assert(param->idx < ARRAY_SIZE(tx->regs.o));
dst = tx->regs.o[param->idx];
}
break;
@@ -1262,7 +1262,7 @@ tx_dst_param_as_src(struct shader_translator *tx, const struct sm1_dst_param *pa
src = ureg_src_register(TGSI_FILE_INPUT, param->idx);
} else {
assert(!param->rel);
- assert(param->idx < Elements(tx->regs.v));
+ assert(param->idx < ARRAY_SIZE(tx->regs.v));
src = tx->regs.v[param->idx];
}
break;
@@ -1437,7 +1437,7 @@ d3dsio_to_string( unsigned opcode )
"BREAKP"
};
- if (opcode < Elements(names)) return names[opcode];
+ if (opcode < ARRAY_SIZE(names)) return names[opcode];
switch (opcode) {
case D3DSIO_PHASE: return "PHASE";
@@ -2030,7 +2030,7 @@ DECL_SPECIAL(DCL)
if (is_input) {
/* linkage outside of shader with vertex declaration */
ureg_DECL_vs_input(ureg, sem.reg.idx);
- assert(sem.reg.idx < Elements(tx->info->input_map));
+ assert(sem.reg.idx < ARRAY_SIZE(tx->info->input_map));
tx->info->input_map[sem.reg.idx] = sm1_to_nine_declusage(&sem);
tx->info->num_inputs = sem.reg.idx + 1;
/* NOTE: preserving order in case of indirect access */
@@ -2040,7 +2040,7 @@ DECL_SPECIAL(DCL)
assert(sem.reg.mask != 0);
if (sem.usage == D3DDECLUSAGE_POSITIONT)
tx->info->position_t = TRUE;
- assert(sem.reg.idx < Elements(tx->regs.o));
+ assert(sem.reg.idx < ARRAY_SIZE(tx->regs.o));
tx->regs.o[sem.reg.idx] = ureg_DECL_output_masked(
ureg, tgsi.Name, tgsi.Index, sem.reg.mask, 0, 1);
@@ -2051,7 +2051,7 @@ DECL_SPECIAL(DCL)
if (is_input && tx->version.major >= 3) {
unsigned interp_location = 0;
/* SM3 only, SM2 input semantic determined by file */
- assert(sem.reg.idx < Elements(tx->regs.v));
+ assert(sem.reg.idx < ARRAY_SIZE(tx->regs.v));
if (tgsi.Name == TGSI_SEMANTIC_POSITION) {
tx->regs.v[sem.reg.idx] = nine_get_position_input(tx);
@@ -2624,7 +2624,7 @@ DECL_SPECIAL(TEXLD)
tx_src_param(tx, &tx->insn.src[1])
};
assert(tx->insn.src[1].idx >= 0 &&
- tx->insn.src[1].idx < Elements(tx->sampler_targets));
+ tx->insn.src[1].idx < ARRAY_SIZE(tx->sampler_targets));
target = tx->sampler_targets[tx->insn.src[1].idx];
switch (tx->insn.flags) {
@@ -2688,7 +2688,7 @@ DECL_SPECIAL(TEXLDD)
tx_src_param(tx, &tx->insn.src[3])
};
assert(tx->insn.src[1].idx >= 0 &&
- tx->insn.src[1].idx < Elements(tx->sampler_targets));
+ tx->insn.src[1].idx < ARRAY_SIZE(tx->sampler_targets));
target = tx->sampler_targets[tx->insn.src[1].idx];
ureg_TXD(tx->ureg, dst, target, src[0], src[2], src[3], src[1]);
@@ -2704,7 +2704,7 @@ DECL_SPECIAL(TEXLDL)
tx_src_param(tx, &tx->insn.src[1])
};
assert(tx->insn.src[1].idx >= 0 &&
- tx->insn.src[1].idx < Elements(tx->sampler_targets));
+ tx->insn.src[1].idx < ARRAY_SIZE(tx->sampler_targets));
target = tx->sampler_targets[tx->insn.src[1].idx];
ureg_TXL(tx->ureg, dst, target, src[0], src[1]);
@@ -2854,19 +2854,19 @@ create_op_info_map(struct shader_translator *tx)
const unsigned version = (tx->version.major << 8) | tx->version.minor;
unsigned i;
- for (i = 0; i < Elements(tx->op_info_map); ++i)
+ for (i = 0; i < ARRAY_SIZE(tx->op_info_map); ++i)
tx->op_info_map[i] = -1;
if (tx->processor == PIPE_SHADER_VERTEX) {
- for (i = 0; i < Elements(inst_table); ++i) {
- assert(inst_table[i].sio < Elements(tx->op_info_map));
+ for (i = 0; i < ARRAY_SIZE(inst_table); ++i) {
+ assert(inst_table[i].sio < ARRAY_SIZE(tx->op_info_map));
if (inst_table[i].vert_version.min <= version &&
inst_table[i].vert_version.max >= version)
tx->op_info_map[inst_table[i].sio] = i;
}
} else {
- for (i = 0; i < Elements(inst_table); ++i) {
- assert(inst_table[i].sio < Elements(tx->op_info_map));
+ for (i = 0; i < ARRAY_SIZE(inst_table); ++i) {
+ assert(inst_table[i].sio < ARRAY_SIZE(tx->op_info_map));
if (inst_table[i].frag_version.min <= version &&
inst_table[i].frag_version.max >= version)
tx->op_info_map[inst_table[i].sio] = i;
@@ -2881,9 +2881,9 @@ NineTranslateInstruction_Generic(struct shader_translator *tx)
struct ureg_src src[4];
unsigned i;
- for (i = 0; i < tx->insn.ndst && i < Elements(dst); ++i)
+ for (i = 0; i < tx->insn.ndst && i < ARRAY_SIZE(dst); ++i)
dst[i] = tx_dst_param(tx, &tx->insn.dst[i]);
- for (i = 0; i < tx->insn.nsrc && i < Elements(src); ++i)
+ for (i = 0; i < tx->insn.nsrc && i < ARRAY_SIZE(src); ++i)
src[i] = tx_src_param(tx, &tx->insn.src[i]);
ureg_insn(tx->ureg, tx->insn.info->opcode,
@@ -3125,10 +3125,10 @@ sm1_parse_instruction(struct shader_translator *tx)
insn->coissue = !!(tok & D3DSI_COISSUE);
insn->predicated = !!(tok & NINED3DSHADER_INST_PREDICATED);
- if (insn->opcode < Elements(tx->op_info_map)) {
+ if (insn->opcode < ARRAY_SIZE(tx->op_info_map)) {
int k = tx->op_info_map[insn->opcode];
if (k >= 0) {
- assert(k < Elements(inst_table));
+ assert(k < ARRAY_SIZE(inst_table));
info = &inst_table[k];
}
} else {
@@ -3195,7 +3195,7 @@ tx_ctor(struct shader_translator *tx, struct nine_shader_info *info)
tx->byte_code = info->byte_code;
tx->parse = info->byte_code;
- for (i = 0; i < Elements(info->input_map); ++i)
+ for (i = 0; i < ARRAY_SIZE(info->input_map); ++i)
info->input_map[i] = NINE_DECLUSAGE_NONE;
info->num_inputs = 0;
@@ -3214,7 +3214,7 @@ tx_ctor(struct shader_translator *tx, struct nine_shader_info *info)
info->bumpenvmat_needed = 0;
- for (i = 0; i < Elements(tx->regs.rL); ++i) {
+ for (i = 0; i < ARRAY_SIZE(tx->regs.rL); ++i) {
tx->regs.rL[i] = ureg_dst_undef();
}
tx->regs.address = ureg_dst_undef();
@@ -3223,18 +3223,18 @@ tx_ctor(struct shader_translator *tx, struct nine_shader_info *info)
tx->regs.oDepth = ureg_dst_undef();
tx->regs.vPos = ureg_src_undef();
tx->regs.vFace = ureg_src_undef();
- for (i = 0; i < Elements(tx->regs.o); ++i)
+ for (i = 0; i < ARRAY_SIZE(tx->regs.o); ++i)
tx->regs.o[i] = ureg_dst_undef();
- for (i = 0; i < Elements(tx->regs.oCol); ++i)
+ for (i = 0; i < ARRAY_SIZE(tx->regs.oCol); ++i)
tx->regs.oCol[i] = ureg_dst_undef();
- for (i = 0; i < Elements(tx->regs.vC); ++i)
+ for (i = 0; i < ARRAY_SIZE(tx->regs.vC); ++i)
tx->regs.vC[i] = ureg_src_undef();
- for (i = 0; i < Elements(tx->regs.vT); ++i)
+ for (i = 0; i < ARRAY_SIZE(tx->regs.vT); ++i)
tx->regs.vT[i] = ureg_src_undef();
- for (i = 0; i < Elements(tx->lconsti); ++i)
+ for (i = 0; i < ARRAY_SIZE(tx->lconsti); ++i)
tx->lconsti[i].idx = -1;
- for (i = 0; i < Elements(tx->lconstb); ++i)
+ for (i = 0; i < ARRAY_SIZE(tx->lconstb); ++i)
tx->lconstb[i].idx = -1;
sm1_read_version(tx);
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index f8af969f283..2172a63d2c3 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -1250,7 +1250,7 @@ nine_state_set_defaults(struct NineDevice9 *device, const D3DCAPS9 *caps,
*/
memcpy(state->rs, nine_render_state_defaults, sizeof(state->rs));
- for (s = 0; s < Elements(state->ff.tex_stage); ++s) {
+ for (s = 0; s < ARRAY_SIZE(state->ff.tex_stage); ++s) {
memcpy(&state->ff.tex_stage[s], nine_tex_stage_state_defaults,
sizeof(state->ff.tex_stage[s]));
state->ff.tex_stage[s][D3DTSS_TEXCOORDINDEX] = s;
@@ -1259,7 +1259,7 @@ nine_state_set_defaults(struct NineDevice9 *device, const D3DCAPS9 *caps,
state->ff.tex_stage[0][D3DTSS_ALPHAOP] = D3DTOP_SELECTARG1;
memset(&state->bumpmap_vars, 0, sizeof(state->bumpmap_vars));
- for (s = 0; s < Elements(state->samp); ++s) {
+ for (s = 0; s < ARRAY_SIZE(state->samp); ++s) {
memcpy(&state->samp[s], nine_samp_state_defaults,
sizeof(state->samp[s]));
}
@@ -1290,7 +1290,7 @@ nine_state_set_defaults(struct NineDevice9 *device, const D3DCAPS9 *caps,
state->viewport.MaxZ = 1.0f;
}
- for (s = 0; s < Elements(state->changed.sampler); ++s)
+ for (s = 0; s < ARRAY_SIZE(state->changed.sampler); ++s)
state->changed.sampler[s] = ~0;
if (!is_reset) {
@@ -1321,7 +1321,7 @@ nine_state_clear(struct nine_state *state, const boolean device)
{
unsigned i;
- for (i = 0; i < Elements(state->rt); ++i)
+ for (i = 0; i < ARRAY_SIZE(state->rt); ++i)
nine_bind(&state->rt[i], NULL);
nine_bind(&state->ds, NULL);
nine_bind(&state->vs, NULL);
diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c
index cc368b7f725..bcc00ab88d5 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -172,7 +172,7 @@ nine_state_copy_common(struct nine_state *dst,
/* Render states.
* TODO: Maybe build a list ?
*/
- for (i = 0; i < Elements(dst->changed.rs); ++i) {
+ for (i = 0; i < ARRAY_SIZE(dst->changed.rs); ++i) {
uint32_t m = mask->changed.rs[i];
if (apply)
dst->changed.rs[i] |= m;
@@ -309,7 +309,7 @@ nine_state_copy_common(struct nine_state *dst,
dst->ff.num_lights_active = src->ff.num_lights_active;
}
if (mask->changed.group & NINE_STATE_FF_VSTRANSF) {
- for (i = 0; i < Elements(mask->ff.changed.transform); ++i) {
+ for (i = 0; i < ARRAY_SIZE(mask->ff.changed.transform); ++i) {
if (!mask->ff.changed.transform[i])
continue;
for (s = i * 32; s < (i * 32 + 32); ++s) {
@@ -404,7 +404,7 @@ nine_state_copy_common_all(struct nine_state *dst,
/* Vertex streams. */
if (1) {
- for (i = 0; i < Elements(dst->stream); ++i) {
+ for (i = 0; i < ARRAY_SIZE(dst->stream); ++i) {
nine_bind(&dst->stream[i], src->stream[i]);
if (src->stream[i]) {
dst->vtxbuf[i].buffer_offset = src->vtxbuf[i].buffer_offset;
diff --git a/src/gallium/state_trackers/nine/vertexshader9.c b/src/gallium/state_trackers/nine/vertexshader9.c
index 7978ea8925b..eb426ca67d7 100644
--- a/src/gallium/state_trackers/nine/vertexshader9.c
+++ b/src/gallium/state_trackers/nine/vertexshader9.c
@@ -82,7 +82,7 @@ NineVertexShader9_ctor( struct NineVertexShader9 *This,
This->position_t = info.position_t;
This->point_size = info.point_size;
- for (i = 0; i < info.num_inputs && i < Elements(This->input_map); ++i)
+ for (i = 0; i < info.num_inputs && i < ARRAY_SIZE(This->input_map); ++i)
This->input_map[i].ndecl = info.input_map[i];
This->num_inputs = i;
diff --git a/src/gallium/state_trackers/omx/vid_dec_h264.c b/src/gallium/state_trackers/omx/vid_dec_h264.c
index 9aab6d1a1a3..54f244b4a1e 100644
--- a/src/gallium/state_trackers/omx/vid_dec_h264.c
+++ b/src/gallium/state_trackers/omx/vid_dec_h264.c
@@ -247,7 +247,7 @@ static void scaling_list(struct vl_rbsp *rbsp, uint8_t *scalingList, unsigned si
static struct pipe_h264_sps *seq_parameter_set_id(vid_dec_PrivateType *priv, struct vl_rbsp *rbsp)
{
unsigned id = vl_rbsp_ue(rbsp);
- if (id >= Elements(priv->codec_data.h264.sps))
+ if (id >= ARRAY_SIZE(priv->codec_data.h264.sps))
return NULL; /* invalid seq_parameter_set_id */
return &priv->codec_data.h264.sps[id];
@@ -395,7 +395,7 @@ static void seq_parameter_set(vid_dec_PrivateType *priv, struct vl_rbsp *rbsp)
static struct pipe_h264_pps *pic_parameter_set_id(vid_dec_PrivateType *priv, struct vl_rbsp *rbsp)
{
unsigned id = vl_rbsp_ue(rbsp);
- if (id >= Elements(priv->codec_data.h264.pps))
+ if (id >= ARRAY_SIZE(priv->codec_data.h264.pps))
return NULL; /* invalid pic_parameter_set_id */
return &priv->codec_data.h264.pps[id];
diff --git a/src/gallium/state_trackers/osmesa/osmesa.c b/src/gallium/state_trackers/osmesa/osmesa.c
index 38d684b8e9c..10715076f59 100644
--- a/src/gallium/state_trackers/osmesa/osmesa.c
+++ b/src/gallium/state_trackers/osmesa/osmesa.c
@@ -324,7 +324,7 @@ osmesa_st_framebuffer_flush_front(struct st_context_iface *stctx,
unsigned i;
/* Find the z/stencil buffer if there is one */
- for (i = 0; i < Elements(osbuffer->textures); i++) {
+ for (i = 0; i < ARRAY_SIZE(osbuffer->textures); i++) {
struct pipe_resource *res = osbuffer->textures[i];
if (res) {
const struct util_format_description *desc =
@@ -791,7 +791,7 @@ OSMesaMakeCurrent(OSMesaContext osmesa, void *buffer, GLenum type,
boolean any_pp_enabled = FALSE;
unsigned i;
- for (i = 0; i < Elements(osmesa->pp_enabled); i++) {
+ for (i = 0; i < ARRAY_SIZE(osmesa->pp_enabled); i++) {
if (osmesa->pp_enabled[i]) {
any_pp_enabled = TRUE;
break;
diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c
index 861dac260a9..8a6a397528a 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -745,9 +745,9 @@ vlVaQueryVideoProcPipelineCaps(VADriverContextP ctx, VAContextID context,
pipeline_cap->filter_flags = 0;
pipeline_cap->num_forward_references = 0;
pipeline_cap->num_backward_references = 0;
- pipeline_cap->num_input_color_standards = Elements(vpp_input_color_standards);
+ pipeline_cap->num_input_color_standards = ARRAY_SIZE(vpp_input_color_standards);
pipeline_cap->input_color_standards = vpp_input_color_standards;
- pipeline_cap->num_output_color_standards = Elements(vpp_output_color_standards);
+ pipeline_cap->num_output_color_standards = ARRAY_SIZE(vpp_output_color_standards);
pipeline_cap->output_color_standards = vpp_output_color_standards;
for (i = 0; i < num_filters; i++) {
diff --git a/src/gallium/state_trackers/vdpau/ftab.c b/src/gallium/state_trackers/vdpau/ftab.c
index 901a444f1c7..31786229bc5 100644
--- a/src/gallium/state_trackers/vdpau/ftab.c
+++ b/src/gallium/state_trackers/vdpau/ftab.c
@@ -121,17 +121,17 @@ boolean vlGetFuncFTAB(VdpFuncId function_id, void **func)
*func = NULL;
if (function_id < VDP_FUNC_ID_BASE_WINSYS) {
- if (function_id < Elements(ftab))
+ if (function_id < ARRAY_SIZE(ftab))
*func = ftab[function_id];
} else if (function_id < VDP_FUNC_ID_BASE_DRIVER) {
function_id -= VDP_FUNC_ID_BASE_WINSYS;
- if (function_id < Elements(ftab_winsys))
+ if (function_id < ARRAY_SIZE(ftab_winsys))
*func = ftab_winsys[function_id];
} else {
function_id -= VDP_FUNC_ID_BASE_DRIVER;
- if (function_id < Elements(ftab_driver))
+ if (function_id < ARRAY_SIZE(ftab_driver))
*func = ftab_driver[function_id];
}
diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c
index 5360a8f6036..8407b9e1ae4 100644
--- a/src/gallium/state_trackers/wgl/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c
@@ -247,7 +247,7 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats,
bind_flags |= PIPE_BIND_DISPLAY_TARGET;
}
- for (ms = 0; ms < Elements(stw_pf_multisample); ms++) {
+ for (ms = 0; ms < ARRAY_SIZE(stw_pf_multisample); ms++) {
unsigned samples = stw_pf_multisample[ms];
if (force_samples && samples != force_samples)
@@ -260,10 +260,10 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats,
continue;
}
- for (db = 0; db < Elements(stw_pf_doublebuffer); db++) {
+ for (db = 0; db < ARRAY_SIZE(stw_pf_doublebuffer); db++) {
unsigned doublebuffer = stw_pf_doublebuffer[db];
- for (ds = 0; ds < Elements(stw_pf_depth_stencil); ds++) {
+ for (ds = 0; ds < ARRAY_SIZE(stw_pf_depth_stencil); ds++) {
const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[ds];
if (!screen->is_format_supported(screen, depth->format,
@@ -297,12 +297,12 @@ stw_pixelformat_init( void )
/* normal, displayable formats */
num_formats = add_color_format_variants(stw_pf_color,
- Elements(stw_pf_color), FALSE);
+ ARRAY_SIZE(stw_pf_color), FALSE);
assert(num_formats > 0);
/* extended, pbuffer-only formats */
add_color_format_variants(stw_pf_color_extended,
- Elements(stw_pf_color_extended), TRUE);
+ ARRAY_SIZE(stw_pf_color_extended), TRUE);
assert( stw_dev->pixelformat_count <= stw_dev->pixelformat_extended_count );
assert( stw_dev->pixelformat_extended_count <= STW_MAX_PIXELFORMATS );