diff options
author | Zack Rusin <[email protected]> | 2010-07-16 11:58:20 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2010-07-16 11:58:20 -0400 |
commit | b77f5024ca2926404d701276eafc72f5769daa32 (patch) | |
tree | 1dd2106a0d8ee4fdf1c4613f0c58933129fc2860 /src/gallium | |
parent | 41bcd8cb1ee93209d38af7b47a158d20a6c5ae11 (diff) |
draw: use the instance id when fetching vertex data
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 315544d7b87..61c53a06b37 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -368,7 +368,8 @@ generate_fetch(LLVMBuilderRef builder, 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, @@ -393,6 +394,11 @@ generate_fetch(LLVMBuilderRef builder, 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, ""); @@ -745,7 +751,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant) 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, @@ -908,7 +915,8 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian 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, |