draw/translate: fix instancing
authorZack Rusin <zackr@vmware.com>
Fri, 28 Jun 2013 00:40:10 +0000 (20:40 -0400)
committerZack Rusin <zackr@vmware.com>
Fri, 28 Jun 2013 09:21:20 +0000 (05:21 -0400)
commit1c2e5c223da28cdffe156b6b430fcdf638909021
treef86833cf8b5b43134231309cc75932da000de080
parentdf4ab7974a825bf686f9dfa3474f3648e9a3ca66
draw/translate: fix instancing

We were incorrectly computing the buffer offset when using the
instances. The buffer offset is always equal to:
start_instance * stride + (instance_num / instance_divisor) *
stride
We were completely ignoring the start instance quite
often producing instances that completely wrong, e.g. if
start instance = 5, instance divisor = 2, then on the first
iteration it should be:
5 * stride, not (5/2) * stride as we'd have currently, and if
start instance = 1, instance divisor = 3, then on the first
iteration it should be:
1 * stride, not 0 as we'd have.
This fixes it and adjusts all the code to the changes.

Signed-off-by: Zack Rusin <zackr@vmware.com>
17 files changed:
src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/auxiliary/draw/draw_pipe_vbuf.c
src/gallium/auxiliary/draw/draw_private.h
src/gallium/auxiliary/draw/draw_pt.c
src/gallium/auxiliary/draw/draw_pt_emit.c
src/gallium/auxiliary/draw/draw_pt_fetch.c
src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
src/gallium/auxiliary/draw/draw_pt_so_emit.c
src/gallium/auxiliary/draw/draw_vs_variant.c
src/gallium/auxiliary/translate/translate.h
src/gallium/auxiliary/translate/translate_generic.c
src/gallium/auxiliary/translate/translate_sse.c
src/gallium/auxiliary/util/u_vbuf.c
src/gallium/drivers/nv30/nv30_push.c
src/gallium/drivers/nv50/nv50_push.c
src/gallium/drivers/nvc0/nvc0_push.c
src/gallium/drivers/nvc0/nvc0_vbo_translate.c