LLVMValueRef *res,
struct pipe_vertex_element *velem,
LLVMValueRef vbuf,
- LLVMValueRef index)
+ LLVMValueRef index,
+ unsigned instance_id)
{
LLVMValueRef indices = LLVMConstInt(LLVMInt64Type(), velem->vertex_buffer_index, 0);
LLVMValueRef vbuffer_ptr = LLVMBuildGEP(builder, vbuffers_ptr,
stride = LLVMBuildAdd(builder, stride,
LLVMConstInt(LLVMInt32Type(), velem->src_offset, 0),
"");
+ if (velem->instance_divisor) {
+ stride = LLVMBuildMul(builder, stride,
+ LLVMConstInt(LLVMInt32Type(), instance_id, 0),
+ "");
+ }
/*lp_build_printf(builder, "vbuf index = %d, stride is %d\n", indices, stride);*/
vbuffer_ptr = LLVMBuildGEP(builder, vbuffer_ptr, &stride, 1, "");
LLVMValueRef vb = LLVMBuildGEP(builder, vb_ptr,
&vb_index, 1, "");
generate_fetch(builder, vbuffers_ptr,
- &aos_attribs[j][i], velem, vb, true_index);
+ &aos_attribs[j][i], velem, vb, true_index,
+ draw->instance_id);
}
}
convert_to_soa(builder, aos_attribs, inputs,
LLVMValueRef vb = LLVMBuildGEP(builder, vb_ptr,
&vb_index, 1, "");
generate_fetch(builder, vbuffers_ptr,
- &aos_attribs[j][i], velem, vb, true_index);
+ &aos_attribs[j][i], velem, vb, true_index,
+ draw->instance_id);
}
}
convert_to_soa(builder, aos_attribs, inputs,