diff options
author | Jan Vesely <[email protected]> | 2016-05-17 09:25:44 -0400 |
---|---|---|
committer | Jan Vesely <[email protected]> | 2016-05-17 15:28:04 -0400 |
commit | 47b390fe45e5e6f982c60b58985892438959cd8e (patch) | |
tree | 61a26199f85287a7e918c6c52db243280b6a3cba /src/gallium/state_trackers/nine | |
parent | 322cd2457ccf66a0a88d92f0b0dec1cb3f93eae4 (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/nine')
-rw-r--r-- | src/gallium/state_trackers/nine/device9.c | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_ff.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_shader.c | 64 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.c | 8 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/stateblock9.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/vertexshader9.c | 2 |
6 files changed, 48 insertions, 48 deletions
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; |