diff options
-rw-r--r-- | src/gallium/drivers/ilo/ilo_blit.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render_dynamic.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render_surface.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_screen.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_shader.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_state.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/shader/ilo_shader_fs.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/shader/ilo_shader_vs.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/shader/toy_compiler.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/shader/toy_compiler_asm.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/shader/toy_legalize.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/shader/toy_legalize_ra.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/shader/toy_tgsi.c | 12 |
14 files changed, 43 insertions, 43 deletions
diff --git a/src/gallium/drivers/ilo/ilo_blit.h b/src/gallium/drivers/ilo/ilo_blit.h index bad4dab8404..008dd46a73c 100644 --- a/src/gallium/drivers/ilo/ilo_blit.h +++ b/src/gallium/drivers/ilo/ilo_blit.h @@ -162,7 +162,7 @@ ilo_blit_resolve_framebuffer(struct ilo_context *ilo) unsigned sh, i; /* Not all bound views are sampled by the shaders. How do we tell? */ - for (sh = 0; sh < Elements(vec->view); sh++) { + for (sh = 0; sh < ARRAY_SIZE(vec->view); sh++) { for (i = 0; i < vec->view[sh].count; i++) { if (vec->view[sh].states[i]) ilo_blit_resolve_view(ilo, vec->view[sh].states[i]); diff --git a/src/gallium/drivers/ilo/ilo_render.c b/src/gallium/drivers/ilo/ilo_render.c index 9a47ca80505..efb0a674db2 100644 --- a/src/gallium/drivers/ilo/ilo_render.c +++ b/src/gallium/drivers/ilo/ilo_render.c @@ -287,7 +287,7 @@ ilo_render_emit_query(struct ilo_render *render, break; case PIPE_QUERY_PIPELINE_STATISTICS: regs = pipeline_statistics_regs; - reg_count = Elements(pipeline_statistics_regs); + reg_count = ARRAY_SIZE(pipeline_statistics_regs); break; default: break; diff --git a/src/gallium/drivers/ilo/ilo_render_dynamic.c b/src/gallium/drivers/ilo/ilo_render_dynamic.c index 3b4c80227a6..813b80aa87c 100644 --- a/src/gallium/drivers/ilo/ilo_render_dynamic.c +++ b/src/gallium/drivers/ilo/ilo_render_dynamic.c @@ -186,8 +186,8 @@ gen6_emit_draw_dynamic_samplers(struct ilo_render *r, if (skip) return; - assert(sampler_count <= Elements(vec->view[shader_type].states) && - sampler_count <= Elements(vec->sampler[shader_type].cso)); + assert(sampler_count <= ARRAY_SIZE(vec->view[shader_type].states) && + sampler_count <= ARRAY_SIZE(vec->sampler[shader_type].cso)); if (emit_border_color) { for (i = 0; i < sampler_count; i++) { @@ -482,8 +482,8 @@ gen6_emit_launch_grid_dynamic_samplers(struct ilo_render *r, sampler_count = ilo_shader_get_kernel_param(cs, ILO_KERNEL_SAMPLER_COUNT); - assert(sampler_count <= Elements(vec->view[shader_type].states) && - sampler_count <= Elements(vec->sampler[shader_type].cso)); + assert(sampler_count <= ARRAY_SIZE(vec->view[shader_type].states) && + sampler_count <= ARRAY_SIZE(vec->sampler[shader_type].cso)); for (i = 0; i < sampler_count; i++) { const struct ilo_sampler_cso *cso = vec->sampler[shader_type].cso[i]; diff --git a/src/gallium/drivers/ilo/ilo_render_surface.c b/src/gallium/drivers/ilo/ilo_render_surface.c index 3bf8646b344..50f00d20bf3 100644 --- a/src/gallium/drivers/ilo/ilo_render_surface.c +++ b/src/gallium/drivers/ilo/ilo_render_surface.c @@ -530,9 +530,9 @@ gen6_emit_launch_grid_surface_global(struct ilo_render *r, if (!count) return; - if (base + count > Elements(r->state.cs.SURFACE_STATE)) { + if (base + count > ARRAY_SIZE(r->state.cs.SURFACE_STATE)) { ilo_warn("too many global bindings\n"); - count = Elements(r->state.cs.SURFACE_STATE) - base; + count = ARRAY_SIZE(r->state.cs.SURFACE_STATE) - base; } /* SURFACE_STATEs for global bindings */ diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index 538f817e242..2fc1873b279 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -211,7 +211,7 @@ ilo_get_compute_param(struct pipe_screen *screen, size = strlen(val.ir_target) + 1; break; case PIPE_COMPUTE_CAP_GRID_DIMENSION: - val.grid_dimension = Elements(val.max_grid_size); + val.grid_dimension = ARRAY_SIZE(val.max_grid_size); ptr = &val.grid_dimension; size = sizeof(val.grid_dimension); diff --git a/src/gallium/drivers/ilo/ilo_shader.c b/src/gallium/drivers/ilo/ilo_shader.c index 4eab174e433..f8c0811eacf 100644 --- a/src/gallium/drivers/ilo/ilo_shader.c +++ b/src/gallium/drivers/ilo/ilo_shader.c @@ -1168,8 +1168,8 @@ ilo_shader_select_kernel_sbe(struct ilo_shader_state *shader, routing->sprite_coord_enable = sprite_coord_enable; routing->sprite_coord_mode = sprite_coord_mode; - assert(kernel->in.count <= Elements(swizzles)); - dst_len = MIN2(kernel->in.count, Elements(swizzles)); + assert(kernel->in.count <= ARRAY_SIZE(swizzles)); + dst_len = MIN2(kernel->in.count, ARRAY_SIZE(swizzles)); memset(&swizzles, 0, sizeof(swizzles)); memset(&info, 0, sizeof(info)); diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c index f8d2637cc6f..37234ec08e8 100644 --- a/src/gallium/drivers/ilo/ilo_state.c +++ b/src/gallium/drivers/ilo/ilo_state.c @@ -1060,7 +1060,7 @@ ilo_bind_sampler_states(struct pipe_context *pipe, unsigned shader, bool changed = false; unsigned i; - assert(start + count <= Elements(dst->cso)); + assert(start + count <= ARRAY_SIZE(dst->cso)); if (samplers) { for (i = 0; i < count; i++) { @@ -1544,8 +1544,8 @@ ilo_set_constant_buffer(struct pipe_context *pipe, const unsigned count = 1; unsigned i; - assert(shader < Elements(vec->cbuf)); - assert(index + count <= Elements(vec->cbuf[shader].cso)); + assert(shader < ARRAY_SIZE(vec->cbuf)); + assert(index + count <= ARRAY_SIZE(vec->cbuf[shader].cso)); if (buf) { for (i = 0; i < count; i++) { @@ -1809,7 +1809,7 @@ ilo_set_sampler_views(struct pipe_context *pipe, unsigned shader, struct ilo_view_state *dst = &vec->view[shader]; unsigned i; - assert(start + count <= Elements(dst->states)); + assert(start + count <= ARRAY_SIZE(dst->states)); if (views) { for (i = 0; i < count; i++) @@ -1858,7 +1858,7 @@ ilo_set_shader_images(struct pipe_context *pipe, unsigned shader, struct ilo_resource_state *dst = &vec->resource; unsigned i; - assert(start + count <= Elements(dst->states)); + assert(start + count <= ARRAY_SIZE(dst->states)); if (surfaces) { for (i = 0; i < count; i++) @@ -2220,7 +2220,7 @@ ilo_set_compute_resources(struct pipe_context *pipe, struct ilo_resource_state *dst = &vec->cs_resource; unsigned i; - assert(start + count <= Elements(dst->states)); + assert(start + count <= ARRAY_SIZE(dst->states)); if (surfaces) { for (i = 0; i < count; i++) @@ -2407,7 +2407,7 @@ ilo_state_vector_cleanup(struct ilo_state_vector *vec) { unsigned i, sh; - for (i = 0; i < Elements(vec->vb.states); i++) { + for (i = 0; i < ARRAY_SIZE(vec->vb.states); i++) { if (vec->vb.enabled_mask & (1 << i)) pipe_resource_reference(&vec->vb.states[i].buffer, NULL); } @@ -2424,7 +2424,7 @@ ilo_state_vector_cleanup(struct ilo_state_vector *vec) pipe_sampler_view_reference(&view, NULL); } - for (i = 0; i < Elements(vec->cbuf[sh].cso); i++) { + for (i = 0; i < ARRAY_SIZE(vec->cbuf[sh].cso); i++) { struct ilo_cbuf_cso *cbuf = &vec->cbuf[sh].cso[i]; pipe_resource_reference(&cbuf->resource, NULL); } @@ -2513,7 +2513,7 @@ ilo_state_vector_resource_renamed(struct ilo_state_vector *vec, } if (res->target == PIPE_BUFFER) { - for (i = 0; i < Elements(vec->cbuf[sh].cso); i++) { + for (i = 0; i < ARRAY_SIZE(vec->cbuf[sh].cso); i++) { struct ilo_cbuf_cso *cbuf = &vec->cbuf[sh].cso[i]; if (cbuf->resource == res) { diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c index d2b205a370d..c55e9fa4b30 100644 --- a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c +++ b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c @@ -1123,7 +1123,7 @@ fs_lower_opcode_tgsi_sampling(struct fs_compile_context *fcc, toy_compiler_lower_to_send(tc, inst, false, GEN6_SFID_SAMPLER); inst->src[0] = tsrc(TOY_FILE_MRF, fcc->first_free_mrf, 0); inst->src[1] = desc; - for (i = 2; i < Elements(inst->src); i++) + for (i = 2; i < ARRAY_SIZE(inst->src); i++) inst->src[i] = tsrc_null(); /* write to temps first */ @@ -1450,12 +1450,12 @@ fs_write_fb(struct fs_compile_context *fcc) int color_slots[ILO_MAX_DRAW_BUFFERS], num_cbufs; int pos_slot = -1, cbuf, i; - for (i = 0; i < Elements(color_slots); i++) + for (i = 0; i < ARRAY_SIZE(color_slots); i++) color_slots[i] = -1; for (i = 0; i < fcc->tgsi.num_outputs; i++) { if (fcc->tgsi.outputs[i].semantic_name == TGSI_SEMANTIC_COLOR) { - assert(fcc->tgsi.outputs[i].semantic_index < Elements(color_slots)); + assert(fcc->tgsi.outputs[i].semantic_index < ARRAY_SIZE(color_slots)); color_slots[fcc->tgsi.outputs[i].semantic_index] = i; } else if (fcc->tgsi.outputs[i].semantic_name == TGSI_SEMANTIC_POSITION) { @@ -1674,7 +1674,7 @@ fs_setup_payloads(struct fs_compile_context *fcc) /* r1-r2: coordinates and etc. */ grf += (fcc->dispatch_mode == GEN6_PS_DISPATCH_32) ? 2 : 1; - for (i = 0; i < Elements(fcc->payloads); i++) { + for (i = 0; i < ARRAY_SIZE(fcc->payloads); i++) { const int reg_scale = (fcc->dispatch_mode == GEN6_PS_DISPATCH_8) ? 1 : 2; diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c index 514e636f327..2a1cad4bf2e 100644 --- a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c +++ b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c @@ -329,7 +329,7 @@ vs_add_sampler_params(struct toy_compiler *tc, int msg_type, int base_mrf, assert(num_coords <= 4); assert(num_derivs <= 3 && num_derivs <= num_coords); - for (i = 0; i < Elements(m); i++) + for (i = 0; i < ARRAY_SIZE(m); i++) m[i] = tdst(TOY_FILE_MRF, base_mrf + i, 0); switch (msg_type) { diff --git a/src/gallium/drivers/ilo/shader/toy_compiler.c b/src/gallium/drivers/ilo/shader/toy_compiler.c index a4c2a2c4e20..99f1ad1505f 100644 --- a/src/gallium/drivers/ilo/shader/toy_compiler.c +++ b/src/gallium/drivers/ilo/shader/toy_compiler.c @@ -449,7 +449,7 @@ tc_dump_inst(struct toy_compiler *tc, const struct toy_inst *inst) tc_dump_dst(tc, inst->dst); - for (i = 0; i < Elements(inst->src); i++) { + for (i = 0; i < ARRAY_SIZE(inst->src); i++) { if (tsrc_is_null(inst->src[i])) break; @@ -522,10 +522,10 @@ tc_init_inst_templ(struct toy_compiler *tc) templ->marker = false; templ->dst = tdst_null(); - for (i = 0; i < Elements(templ->src); i++) + for (i = 0; i < ARRAY_SIZE(templ->src); i++) templ->src[i] = tsrc_null(); - for (i = 0; i < Elements(templ->tex.offsets); i++) + for (i = 0; i < ARRAY_SIZE(templ->tex.offsets); i++) templ->tex.offsets[i] = tsrc_null(); list_inithead(&templ->list); diff --git a/src/gallium/drivers/ilo/shader/toy_compiler_asm.c b/src/gallium/drivers/ilo/shader/toy_compiler_asm.c index ae1b135e83e..44bc2a79c5a 100644 --- a/src/gallium/drivers/ilo/shader/toy_compiler_asm.c +++ b/src/gallium/drivers/ilo/shader/toy_compiler_asm.c @@ -943,7 +943,7 @@ codegen_validate_region_restrictions(const struct codegen *cg) /* 1. (we don't do 32 anyway) */ assert(exec_size <= 16); - for (i = 0; i < Elements(cg->src); i++) { + for (i = 0; i < ARRAY_SIZE(cg->src); i++) { const int width = width_map[cg->src[i].width]; const int horz_stride = horz_stride_map[cg->src[i].horz_stride]; const int vert_stride = vert_stride_map[cg->src[i].vert_stride]; @@ -1077,7 +1077,7 @@ codegen_prepare(struct codegen *cg, const struct ilo_dev *dev, break; } - for (i = 0; i < Elements(cg->src); i++) { + for (i = 0; i < ARRAY_SIZE(cg->src); i++) { struct codegen_src *src = &cg->src[i]; src->file = translate_vfile(inst->src[i].file); diff --git a/src/gallium/drivers/ilo/shader/toy_legalize.c b/src/gallium/drivers/ilo/shader/toy_legalize.c index 4e573caadf4..d5d67ab8793 100644 --- a/src/gallium/drivers/ilo/shader/toy_legalize.c +++ b/src/gallium/drivers/ilo/shader/toy_legalize.c @@ -80,7 +80,7 @@ toy_compiler_lower_math(struct toy_compiler *tc, struct toy_inst *inst) int i; /* see commit 250770b74d33bb8625c780a74a89477af033d13a */ - for (i = 0; i < Elements(inst->src); i++) { + for (i = 0; i < ARRAY_SIZE(inst->src); i++) { if (tsrc_is_null(inst->src[i])) break; @@ -179,7 +179,7 @@ validate_imm(struct toy_compiler *tc, struct toy_inst *inst) bool move_inst = false; int i; - for (i = 0; i < Elements(inst->src); i++) { + for (i = 0; i < ARRAY_SIZE(inst->src); i++) { struct toy_dst tmp; if (tsrc_is_null(inst->src[i])) @@ -201,7 +201,7 @@ validate_imm(struct toy_compiler *tc, struct toy_inst *inst) } /* this is the last operand */ - if (i + 1 == Elements(inst->src) || tsrc_is_null(inst->src[i + 1])) + if (i + 1 == ARRAY_SIZE(inst->src) || tsrc_is_null(inst->src[i + 1])) break; /* need to use a temp if this imm is not the last operand */ @@ -600,7 +600,7 @@ toy_compiler_legalize_for_asm(struct toy_compiler *tc) /* MRF to GRF */ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) { - for (i = 0; i < Elements(inst->src); i++) { + for (i = 0; i < ARRAY_SIZE(inst->src); i++) { if (inst->src[i].file != TOY_FILE_MRF) continue; else if (tsrc_is_null(inst->src[i])) diff --git a/src/gallium/drivers/ilo/shader/toy_legalize_ra.c b/src/gallium/drivers/ilo/shader/toy_legalize_ra.c index 1874faa6be3..04998747670 100644 --- a/src/gallium/drivers/ilo/shader/toy_legalize_ra.c +++ b/src/gallium/drivers/ilo/shader/toy_legalize_ra.c @@ -407,7 +407,7 @@ linear_scan_init_live_intervals(struct linear_scan *ls, } } - for (i = 0; i < Elements(inst->src); i++) { + for (i = 0; i < ARRAY_SIZE(inst->src); i++) { if (inst->src[i].file != TOY_FILE_VRF) continue; @@ -539,7 +539,7 @@ linear_scan_allocation(struct toy_compiler *tc, inst->dst.val32 = reg * TOY_REG_WIDTH + subreg; } - for (i = 0; i < Elements(inst->src); i++) { + for (i = 0; i < ARRAY_SIZE(inst->src); i++) { const uint32_t val32 = inst->src[i].val32; int reg, subreg; @@ -589,7 +589,7 @@ trivial_allocation(struct toy_compiler *tc, max_grf = reg; } - for (i = 0; i < Elements(inst->src); i++) { + for (i = 0; i < ARRAY_SIZE(inst->src); i++) { const uint32_t val32 = inst->src[i].val32; int reg, subreg; diff --git a/src/gallium/drivers/ilo/shader/toy_tgsi.c b/src/gallium/drivers/ilo/shader/toy_tgsi.c index 9a7140b9a9b..e5fbb6e592a 100644 --- a/src/gallium/drivers/ilo/shader/toy_tgsi.c +++ b/src/gallium/drivers/ilo/shader/toy_tgsi.c @@ -190,7 +190,7 @@ aos_simple(struct toy_compiler *tc, inst->dst = dst[0]; } - assert(num_src <= Elements(inst->src)); + assert(num_src <= ARRAY_SIZE(inst->src)); for (i = 0; i < num_src; i++) inst->src[i] = src[i]; } @@ -380,7 +380,7 @@ aos_tex(struct toy_compiler *tc, inst->opcode = opcode; inst->tex.target = tgsi_inst->Texture.Texture; - assert(tgsi_inst->Instruction.NumSrcRegs <= Elements(inst->src)); + assert(tgsi_inst->Instruction.NumSrcRegs <= ARRAY_SIZE(inst->src)); assert(tgsi_inst->Instruction.NumDstRegs == 1); inst->dst = dst[0]; @@ -449,7 +449,7 @@ aos_sample(struct toy_compiler *tc, inst = tc_add(tc); inst->opcode = opcode; - assert(tgsi_inst->Instruction.NumSrcRegs <= Elements(inst->src)); + assert(tgsi_inst->Instruction.NumSrcRegs <= ARRAY_SIZE(inst->src)); assert(tgsi_inst->Instruction.NumDstRegs == 1); inst->dst = dst[0]; @@ -2118,7 +2118,7 @@ decl_add_in(struct toy_tgsi *tgsi, const struct tgsi_full_declaration *decl) (decl->Declaration.Interpolate) ? &decl->Interp: &default_interp; int index; - if (decl->Range.Last >= Elements(tgsi->inputs)) { + if (decl->Range.Last >= ARRAY_SIZE(tgsi->inputs)) { assert(!"invalid IN"); return; } @@ -2146,7 +2146,7 @@ decl_add_out(struct toy_tgsi *tgsi, const struct tgsi_full_declaration *decl) { int index; - if (decl->Range.Last >= Elements(tgsi->outputs)) { + if (decl->Range.Last >= ARRAY_SIZE(tgsi->outputs)) { assert(!"invalid OUT"); return; } @@ -2169,7 +2169,7 @@ decl_add_sv(struct toy_tgsi *tgsi, const struct tgsi_full_declaration *decl) { int index; - if (decl->Range.Last >= Elements(tgsi->system_values)) { + if (decl->Range.Last >= ARRAY_SIZE(tgsi->system_values)) { assert(!"invalid SV"); return; } |