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/drivers/nv30/nv30_push.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gallium/drivers/nv30') diff --git a/src/gallium/drivers/nv30/nv30_push.c b/src/gallium/drivers/nv30/nv30_push.c index 854d2d7222a..d37af2c7b2b 100644 --- a/src/gallium/drivers/nv30/nv30_push.c +++ b/src/gallium/drivers/nv30/nv30_push.c @@ -99,7 +99,7 @@ emit_vertices_i08(struct push_context *ctx, unsigned start, unsigned count) BEGIN_NI04(ctx->push, NV30_3D(VERTEX_DATA), size); - ctx->translate->run_elts8(ctx->translate, elts, nr, 0, ctx->push->cur); + ctx->translate->run_elts8(ctx->translate, elts, nr, 0, 0, ctx->push->cur); ctx->push->cur += size; count -= nr; @@ -131,7 +131,7 @@ emit_vertices_i16(struct push_context *ctx, unsigned start, unsigned count) BEGIN_NI04(ctx->push, NV30_3D(VERTEX_DATA), size); - ctx->translate->run_elts16(ctx->translate, elts, nr, 0, ctx->push->cur); + ctx->translate->run_elts16(ctx->translate, elts, nr, 0, 0, ctx->push->cur); ctx->push->cur += size; count -= nr; @@ -163,7 +163,7 @@ emit_vertices_i32(struct push_context *ctx, unsigned start, unsigned count) BEGIN_NI04(ctx->push, NV30_3D(VERTEX_DATA), size); - ctx->translate->run_elts(ctx->translate, elts, nr, 0, ctx->push->cur); + ctx->translate->run_elts(ctx->translate, elts, nr, 0, 0, ctx->push->cur); ctx->push->cur += size; count -= nr; @@ -187,7 +187,7 @@ emit_vertices_seq(struct push_context *ctx, unsigned start, unsigned count) BEGIN_NI04(ctx->push, NV30_3D(VERTEX_DATA), size); - ctx->translate->run(ctx->translate, start, push, 0, ctx->push->cur); + ctx->translate->run(ctx->translate, start, push, 0, 0, ctx->push->cur); ctx->push->cur += size; count -= push; start += push; -- cgit v1.2.3