summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nvc0
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-06-27 20:40:10 -0400
committerZack Rusin <[email protected]>2013-06-28 05:21:20 -0400
commit1c2e5c223da28cdffe156b6b430fcdf638909021 (patch)
treef86833cf8b5b43134231309cc75932da000de080 /src/gallium/drivers/nvc0
parentdf4ab7974a825bf686f9dfa3474f3648e9a3ca66 (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/drivers/nvc0')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_push.c8
-rw-r--r--src/gallium/drivers/nvc0/nvc0_vbo_translate.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_push.c b/src/gallium/drivers/nvc0/nvc0_push.c
index 78cc5c20641..75caf8a895c 100644
--- a/src/gallium/drivers/nvc0/nvc0_push.c
+++ b/src/gallium/drivers/nvc0/nvc0_push.c
@@ -137,7 +137,7 @@ emit_vertices_i08(struct push_context *ctx, unsigned start, unsigned count)
BEGIN_NIC0(ctx->push, NVC0_3D(VERTEX_DATA), size);
- ctx->translate->run_elts8(ctx->translate, elts, nr, ctx->instance_id,
+ ctx->translate->run_elts8(ctx->translate, elts, nr, 0, ctx->instance_id,
ctx->push->cur);
ctx->push->cur += size;
@@ -178,7 +178,7 @@ emit_vertices_i16(struct push_context *ctx, unsigned start, unsigned count)
BEGIN_NIC0(ctx->push, NVC0_3D(VERTEX_DATA), size);
- ctx->translate->run_elts16(ctx->translate, elts, nr, ctx->instance_id,
+ ctx->translate->run_elts16(ctx->translate, elts, nr, 0, ctx->instance_id,
ctx->push->cur);
ctx->push->cur += size;
@@ -219,7 +219,7 @@ emit_vertices_i32(struct push_context *ctx, unsigned start, unsigned count)
BEGIN_NIC0(ctx->push, NVC0_3D(VERTEX_DATA), size);
- ctx->translate->run_elts(ctx->translate, elts, nr, ctx->instance_id,
+ ctx->translate->run_elts(ctx->translate, elts, nr, 0, ctx->instance_id,
ctx->push->cur);
ctx->push->cur += size;
@@ -252,7 +252,7 @@ emit_vertices_seq(struct push_context *ctx, unsigned start, unsigned count)
BEGIN_NIC0(ctx->push, NVC0_3D(VERTEX_DATA), size);
- ctx->translate->run(ctx->translate, start, push, ctx->instance_id,
+ ctx->translate->run(ctx->translate, start, push, 0, ctx->instance_id,
ctx->push->cur);
ctx->push->cur += size;
diff --git a/src/gallium/drivers/nvc0/nvc0_vbo_translate.c b/src/gallium/drivers/nvc0/nvc0_vbo_translate.c
index ec52de2b568..6ea4220ea60 100644
--- a/src/gallium/drivers/nvc0/nvc0_vbo_translate.c
+++ b/src/gallium/drivers/nvc0/nvc0_vbo_translate.c
@@ -215,7 +215,7 @@ disp_vertices_i08(struct push_context *ctx, unsigned start, unsigned count)
if (unlikely(ctx->prim_restart))
nR = prim_restart_search_i08(elts, nR, ctx->restart_index);
- translate->run_elts8(translate, elts, nR, ctx->instance_id, ctx->dest);
+ translate->run_elts8(translate, elts, nR, 0, ctx->instance_id, ctx->dest);
count -= nR;
ctx->dest += nR * ctx->vertex_size;
@@ -271,7 +271,7 @@ disp_vertices_i16(struct push_context *ctx, unsigned start, unsigned count)
if (unlikely(ctx->prim_restart))
nR = prim_restart_search_i16(elts, nR, ctx->restart_index);
- translate->run_elts16(translate, elts, nR, ctx->instance_id, ctx->dest);
+ translate->run_elts16(translate, elts, nR, 0, ctx->instance_id, ctx->dest);
count -= nR;
ctx->dest += nR * ctx->vertex_size;
@@ -327,7 +327,7 @@ disp_vertices_i32(struct push_context *ctx, unsigned start, unsigned count)
if (unlikely(ctx->prim_restart))
nR = prim_restart_search_i32(elts, nR, ctx->restart_index);
- translate->run_elts(translate, elts, nR, ctx->instance_id, ctx->dest);
+ translate->run_elts(translate, elts, nR, 0, ctx->instance_id, ctx->dest);
count -= nR;
ctx->dest += nR * ctx->vertex_size;
@@ -376,7 +376,7 @@ disp_vertices_seq(struct push_context *ctx, unsigned start, unsigned count)
struct translate *translate = ctx->translate;
unsigned pos = 0;
- translate->run(translate, start, count, ctx->instance_id, ctx->dest);
+ translate->run(translate, start, count, 0, ctx->instance_id, ctx->dest);
do {
unsigned nr = count;