elem_types[DRAW_JIT_DVBUFFER_SIZE] = int32_type;
dvbuffer_type = LLVMStructTypeInContext(gallivm->context, elem_types,
- Elements(elem_types), 0);
+ ARRAY_SIZE(elem_types), 0);
(void) target; /* silence unused var warning for non-debug build */
LP_CHECK_MEMBER_OFFSET(struct draw_vertex_buffer, map,
LLVMArrayType(int32_type, PIPE_MAX_TEXTURE_LEVELS);
texture_type = LLVMStructTypeInContext(gallivm->context, elem_types,
- Elements(elem_types), 0);
+ ARRAY_SIZE(elem_types), 0);
(void) target; /* silence unused var warning for non-debug build */
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, width,
LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
sampler_type = LLVMStructTypeInContext(gallivm->context, elem_types,
- Elements(elem_types), 0);
+ ARRAY_SIZE(elem_types), 0);
(void) target; /* silence unused var warning for non-debug build */
LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, min_lod,
elem_types[5] = LLVMArrayType(sampler_type,
PIPE_MAX_SAMPLERS); /* samplers */
context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
- Elements(elem_types), 0);
+ ARRAY_SIZE(elem_types), 0);
(void) target; /* silence unused var warning for non-debug build */
LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, vs_constants,
vector_length), 0);
context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
- Elements(elem_types), 0);
+ ARRAY_SIZE(elem_types), 0);
(void) target; /* silence unused var warning for non-debug build */
LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, constants,
elem_types[3] = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0);
vb_type = LLVMStructTypeInContext(gallivm->context, elem_types,
- Elements(elem_types), 0);
+ ARRAY_SIZE(elem_types), 0);
(void) target; /* silence unused var warning for non-debug build */
LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, stride,
elem_types[DRAW_JIT_VERTEX_DATA] = LLVMArrayType(elem_types[1], data_elems);
vertex_header = LLVMStructTypeInContext(gallivm->context, elem_types,
- Elements(elem_types), 0);
+ ARRAY_SIZE(elem_types), 0);
/* these are bit-fields and we can't take address of them
LP_CHECK_MEMBER_OFFSET(struct vertex_header, clipmask,
LLVMTypeRef int32_type = LLVMInt32TypeInContext(context);
LLVMTypeRef arg_types[11];
unsigned num_arg_types =
- elts ? Elements(arg_types) : Elements(arg_types) - 1;
+ elts ? ARRAY_SIZE(arg_types) : ARRAY_SIZE(arg_types) - 1;
LLVMTypeRef func_type;
LLVMValueRef context_ptr;
LLVMBasicBlockRef block;
shader_stage == PIPE_SHADER_GEOMETRY);
if (shader_stage == PIPE_SHADER_VERTEX) {
- assert(sview_idx < Elements(draw->llvm->jit_context.textures));
+ assert(sview_idx < ARRAY_SIZE(draw->llvm->jit_context.textures));
jit_tex = &draw->llvm->jit_context.textures[sview_idx];
} else if (shader_stage == PIPE_SHADER_GEOMETRY) {
- assert(sview_idx < Elements(draw->llvm->gs_jit_context.textures));
+ assert(sview_idx < ARRAY_SIZE(draw->llvm->gs_jit_context.textures));
jit_tex = &draw->llvm->gs_jit_context.textures[sview_idx];
} else {
LLVMVectorType(int32_type, vector_length), 0); /* prim_id_ptr */
arg_types[6] = int32_type;
- func_type = LLVMFunctionType(int32_type, arg_types, Elements(arg_types), 0);
+ func_type = LLVMFunctionType(int32_type, arg_types, ARRAY_SIZE(arg_types), 0);
variant_func = LLVMAddFunction(gallivm->module, func_name, func_type);
LLVMSetFunctionCallConv(variant_func, LLVMCCallConv);
- for (i = 0; i < Elements(arg_types); ++i)
+ for (i = 0; i < ARRAY_SIZE(arg_types); ++i)
if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
LLVMAddAttribute(LLVMGetParam(variant_func, i),
LLVMNoAliasAttribute);
/* context[0].textures[unit].member */
indices[3] = lp_build_const_int32(gallivm, member_index);
- ptr = LLVMBuildGEP(builder, context_ptr, indices, Elements(indices), "");
+ ptr = LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
if (emit_load)
res = LLVMBuildLoad(builder, ptr, "");
/* context[0].samplers[unit].member */
indices[3] = lp_build_const_int32(gallivm, member_index);
- ptr = LLVMBuildGEP(builder, context_ptr, indices, Elements(indices), "");
+ ptr = LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
if (emit_load)
res = LLVMBuildLoad(builder, ptr, "");
if (shader->info.uses_instanceid) {
unsigned i = machine->SysSemanticToIndex[TGSI_SEMANTIC_INSTANCEID];
- assert(i < Elements(machine->SystemValue));
+ assert(i < ARRAY_SIZE(machine->SystemValue));
for (j = 0; j < TGSI_QUAD_SIZE; j++)
machine->SystemValue[i].xyzw[0].i[j] = shader->draw->instance_id;
}
if (shader->info.uses_vertexid) {
unsigned vid = machine->SysSemanticToIndex[TGSI_SEMANTIC_VERTEXID];
- assert(vid < Elements(machine->SystemValue));
+ assert(vid < ARRAY_SIZE(machine->SystemValue));
machine->SystemValue[vid].xyzw[0].i[j] = i + j;
/* XXX this should include base vertex. Where to get it??? */
}
if (shader->info.uses_basevertex) {
unsigned vid = machine->SysSemanticToIndex[TGSI_SEMANTIC_BASEVERTEX];
- assert(vid < Elements(machine->SystemValue));
+ assert(vid < ARRAY_SIZE(machine->SystemValue));
machine->SystemValue[vid].xyzw[0].i[j] = 0;
/* XXX Where to get it??? */
}
if (shader->info.uses_vertexid_nobase) {
unsigned vid = machine->SysSemanticToIndex[TGSI_SEMANTIC_VERTEXID_NOBASE];
- assert(vid < Elements(machine->SystemValue));
+ assert(vid < ARRAY_SIZE(machine->SystemValue));
machine->SystemValue[vid].xyzw[0].i[j] = i + j;
}