Mesa (master): nvc0: fix primitive restart in immediate mode
Christoph Bumiller
chrisbmr at kemper.freedesktop.org
Sat Jan 8 13:26:03 UTC 2011
Module: Mesa
Branch: master
Commit: 703f3597ad0e2b7134d4ea0fc2194eb67161910a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=703f3597ad0e2b7134d4ea0fc2194eb67161910a
Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date: Sat Jan 8 14:24:14 2011 +0100
nvc0: fix primitive restart in immediate mode
---
src/gallium/drivers/nvc0/nvc0_push.c | 24 +++++++++++++++---------
src/gallium/drivers/nvc0/nvc0_vbo.c | 3 +++
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/gallium/drivers/nvc0/nvc0_push.c b/src/gallium/drivers/nvc0/nvc0_push.c
index ccbb776..941be67 100644
--- a/src/gallium/drivers/nvc0/nvc0_push.c
+++ b/src/gallium/drivers/nvc0/nvc0_push.c
@@ -75,13 +75,15 @@ emit_vertices_i08(struct push_context *ctx, unsigned start, unsigned count)
BEGIN_RING_NI(ctx->chan, RING_3D(VERTEX_DATA), size);
- ctx->translate->run_elts8(ctx->translate, elts, push, 0, ctx->chan->cur);
+ ctx->translate->run_elts8(ctx->translate, elts, nr, 0, ctx->chan->cur);
ctx->chan->cur += size;
- count -= push;
- elts += push;
+ count -= nr;
+ elts += nr;
if (nr != push) {
+ count--;
+ elts++;
BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2);
OUT_RING (ctx->chan, 0);
OUT_RING (ctx->chan, ctx->prim);
@@ -106,13 +108,15 @@ emit_vertices_i16(struct push_context *ctx, unsigned start, unsigned count)
BEGIN_RING_NI(ctx->chan, RING_3D(VERTEX_DATA), size);
- ctx->translate->run_elts16(ctx->translate, elts, push, 0, ctx->chan->cur);
+ ctx->translate->run_elts16(ctx->translate, elts, nr, 0, ctx->chan->cur);
ctx->chan->cur += size;
- count -= push;
- elts += push;
+ count -= nr;
+ elts += nr;
if (nr != push) {
+ count--;
+ elts++;
BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2);
OUT_RING (ctx->chan, 0);
OUT_RING (ctx->chan, ctx->prim);
@@ -137,13 +141,15 @@ emit_vertices_i32(struct push_context *ctx, unsigned start, unsigned count)
BEGIN_RING_NI(ctx->chan, RING_3D(VERTEX_DATA), size);
- ctx->translate->run_elts(ctx->translate, elts, push, 0, ctx->chan->cur);
+ ctx->translate->run_elts(ctx->translate, elts, nr, 0, ctx->chan->cur);
ctx->chan->cur += size;
- count -= push;
- elts += push;
+ count -= nr;
+ elts += nr;
if (nr != push) {
+ count--;
+ elts++;
BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2);
OUT_RING (ctx->chan, 0);
OUT_RING (ctx->chan, ctx->prim);
diff --git a/src/gallium/drivers/nvc0/nvc0_vbo.c b/src/gallium/drivers/nvc0/nvc0_vbo.c
index 881f065..fd7a794 100644
--- a/src/gallium/drivers/nvc0/nvc0_vbo.c
+++ b/src/gallium/drivers/nvc0/nvc0_vbo.c
@@ -584,6 +584,9 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
if (info->primitive_restart) {
BEGIN_RING(chan, RING_3D(PRIM_RESTART_INDEX), 1);
OUT_RING (chan, info->restart_index);
+
+ if (info->restart_index > 65535)
+ shorten = FALSE;
}
nvc0_draw_elements(nvc0, shorten,
More information about the mesa-commit
mailing list