From 1c2e5c223da28cdffe156b6b430fcdf638909021 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 27 Jun 2013 20:40:10 -0400 Subject: 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 --- src/gallium/auxiliary/translate/translate.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gallium/auxiliary/translate/translate.h') diff --git a/src/gallium/auxiliary/translate/translate.h b/src/gallium/auxiliary/translate/translate.h index 850ef39ef21..1132114de9d 100644 --- a/src/gallium/auxiliary/translate/translate.h +++ b/src/gallium/auxiliary/translate/translate.h @@ -74,24 +74,28 @@ struct translate; typedef void (PIPE_CDECL *run_elts_func)(struct translate *, const unsigned *elts, unsigned count, + unsigned start_instance, unsigned instance_id, void *output_buffer); typedef void (PIPE_CDECL *run_elts16_func)(struct translate *, const uint16_t *elts, unsigned count, + unsigned start_instance, unsigned instance_id, void *output_buffer); typedef void (PIPE_CDECL *run_elts8_func)(struct translate *, const uint8_t *elts, unsigned count, + unsigned start_instance, unsigned instance_id, void *output_buffer); typedef void (PIPE_CDECL *run_func)(struct translate *, unsigned start, unsigned count, + unsigned start_instance, unsigned instance_id, void *output_buffer); -- cgit v1.2.3