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]);
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;
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++) {
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];
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 */
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);
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));
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++) {
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++) {
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++)
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++)
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++)
{
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);
}
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);
}
}
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) {
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 */
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) {
/* 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;
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) {
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;
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);
/* 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];
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);
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;
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]))
}
/* 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 */
/* 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]))
}
}
- 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;
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;
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;
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];
}
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];
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];
(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;
}
{
int index;
- if (decl->Range.Last >= Elements(tgsi->outputs)) {
+ if (decl->Range.Last >= ARRAY_SIZE(tgsi->outputs)) {
assert(!"invalid OUT");
return;
}
{
int index;
- if (decl->Range.Last >= Elements(tgsi->system_values)) {
+ if (decl->Range.Last >= ARRAY_SIZE(tgsi->system_values)) {
assert(!"invalid SV");
return;
}