struct pipe_vertex_element *velem,
LLVMValueRef vbuf,
LLVMValueRef index,
- LLVMValueRef instance_id)
+ LLVMValueRef instance_id,
+ LLVMValueRef start_instance)
{
const struct util_format_description *format_desc =
util_format_description(velem->src_format);
* index = start_instance + (instance_id / divisor)
*/
LLVMValueRef current_instance;
- index = lp_build_const_int32(gallivm, draw->start_instance);
current_instance = LLVMBuildUDiv(builder, instance_id,
lp_build_const_int32(gallivm, velem->instance_divisor),
"instance_divisor");
- index = lp_build_uadd_overflow(gallivm, index, current_instance, &ofbit);
+ index = lp_build_uadd_overflow(gallivm, start_instance,
+ current_instance, &ofbit);
}
stride = lp_build_umul_overflow(gallivm, vb_stride, index, &ofbit);
struct gallivm_state *gallivm = variant->gallivm;
LLVMContextRef context = gallivm->context;
LLVMTypeRef int32_type = LLVMInt32TypeInContext(context);
- LLVMTypeRef arg_types[10];
+ LLVMTypeRef arg_types[11];
unsigned num_arg_types =
elts ? Elements(arg_types) : Elements(arg_types) - 1;
LLVMTypeRef func_type;
struct lp_type vs_type;
LLVMValueRef end, start;
LLVMValueRef count, fetch_elts, fetch_elt_max, fetch_count;
- LLVMValueRef vertex_id_offset;
+ LLVMValueRef vertex_id_offset, start_instance;
LLVMValueRef stride, step, io_itr;
LLVMValueRef io_ptr, vbuffers_ptr, vb_ptr;
LLVMValueRef zero = lp_build_const_int32(gallivm, 0);
arg_types[i++] = get_vb_ptr_type(variant); /* pipe_vertex_buffer's */
arg_types[i++] = int32_type; /* instance_id */
arg_types[i++] = int32_type; /* vertex_id_offset */
+ arg_types[i++] = int32_type; /* start_instance */
func_type = LLVMFunctionType(int32_type, arg_types, num_arg_types, 0);
vb_ptr = LLVMGetParam(variant_func, 6 + (elts ? 1 : 0));
system_values.instance_id = LLVMGetParam(variant_func, 7 + (elts ? 1 : 0));
vertex_id_offset = LLVMGetParam(variant_func, 8 + (elts ? 1 : 0));
+ start_instance = LLVMGetParam(variant_func, 9 + (elts ? 1 : 0));
lp_build_name(context_ptr, "context");
lp_build_name(io_ptr, "io");
lp_build_name(vb_ptr, "vb");
lp_build_name(system_values.instance_id, "instance_id");
lp_build_name(vertex_id_offset, "vertex_id_offset");
+ lp_build_name(start_instance, "start_instance");
if (elts) {
fetch_elts = LLVMGetParam(variant_func, 3);
LLVMValueRef vb = LLVMBuildGEP(builder, vb_ptr, &vb_index, 1, "");
generate_fetch(gallivm, draw, vbuffers_ptr,
&aos_attribs[j][i], velem, vb, true_index,
- system_values.instance_id);
+ system_values.instance_id, start_instance);
}
}
convert_to_soa(gallivm, aos_attribs, inputs,