diff options
author | Brian Paul <brianp@vmware.com> | 2010-07-19 18:29:12 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-07-19 18:29:12 -0600 |
commit | 37692e5dc9bbcf4f48b4401255d47f724a602978 (patch) | |
tree | 976b3cc79e854fbbd42c907e375b151bf69983dd /src/gallium/auxiliary/draw | |
parent | 374c74f4c49ee78c06f677cfb6587cb353bd669c (diff) |
draw: fix incorrect instancing divisor in LLVM code
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 6958c3057c..1ee87697b4 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -380,12 +380,15 @@ generate_fetch(LLVMBuilderRef builder, LLVMValueRef cond; LLVMValueRef stride; - cond = LLVMBuildICmp(builder, LLVMIntULE, index, vb_max_index, ""); - if (velem->instance_divisor) { - index = instance_id; + /* array index = instance_id / instance_divisor */ + index = LLVMBuildUDiv(builder, instance_id, + LLVMConstInt(LLVMInt32Type(), velem->instance_divisor, 0), + "instance_divisor"); } + /* limit index to min(inex, vb_max_index) */ + cond = LLVMBuildICmp(builder, LLVMIntULE, index, vb_max_index, ""); index = LLVMBuildSelect(builder, cond, index, vb_max_index, ""); stride = LLVMBuildMul(builder, vb_stride, index, ""); |