diff options
author | Zack Rusin <[email protected]> | 2013-06-27 20:40:10 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2013-06-28 05:21:20 -0400 |
commit | 1c2e5c223da28cdffe156b6b430fcdf638909021 (patch) | |
tree | f86833cf8b5b43134231309cc75932da000de080 /src/gallium/auxiliary/util | |
parent | df4ab7974a825bf686f9dfa3474f3648e9a3ca66 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r-- | src/gallium/auxiliary/util/u_vbuf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c index 5936f74a039..52b360ed7aa 100644 --- a/src/gallium/auxiliary/util/u_vbuf.c +++ b/src/gallium/auxiliary/util/u_vbuf.c @@ -403,13 +403,13 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key, switch (ib->index_size) { case 4: - tr->run_elts(tr, (unsigned*)map, num_indices, 0, out_map); + tr->run_elts(tr, (unsigned*)map, num_indices, 0, 0, out_map); break; case 2: - tr->run_elts16(tr, (uint16_t*)map, num_indices, 0, out_map); + tr->run_elts16(tr, (uint16_t*)map, num_indices, 0, 0, out_map); break; case 1: - tr->run_elts8(tr, map, num_indices, 0, out_map); + tr->run_elts8(tr, map, num_indices, 0, 0, out_map); break; } @@ -428,7 +428,7 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key, out_offset -= key->output_stride * start_vertex; - tr->run(tr, 0, num_vertices, 0, out_map); + tr->run(tr, 0, num_vertices, 0, 0, out_map); } /* Unmap all buffers. */ |