Mesa (nvc0): nv50: primitive restart trick for vertex data through FIFO mode

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Wed Mar 2 20:01:41 UTC 2011


Module: Mesa
Branch: nvc0
Commit: 47a62b1ca1357ea1f60ae60dd0cfd72f8e5fa1b3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=47a62b1ca1357ea1f60ae60dd0cfd72f8e5fa1b3

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Wed Mar  2 20:48:20 2011 +0100

nv50: primitive restart trick for vertex data through FIFO mode

Also, on nv50 the VERTEX_BEGIN method doesn't follow VERTEX_END,
which was erroneously taken over from nvc0 and is fixed now.

---

 src/gallium/drivers/nv50/nv50_push.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_push.c b/src/gallium/drivers/nv50/nv50_push.c
index 71b5995..e8ad1dd 100644
--- a/src/gallium/drivers/nv50/nv50_push.c
+++ b/src/gallium/drivers/nv50/nv50_push.c
@@ -86,10 +86,8 @@ emit_vertices_i08(struct push_context *ctx, unsigned start, unsigned count)
       if (nr != push) {
          count--;
          elts++;
-         BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2);
-         OUT_RING  (ctx->chan, 0);
-         OUT_RING  (ctx->chan, NVA0_3D_VERTEX_BEGIN_GL_INSTANCE_CONT |
-                    (ctx->prim & ~NV50_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT));
+         BEGIN_RING(ctx->chan, RING_3D(VB_ELEMENT_U32), 1);
+         OUT_RING  (ctx->chan, ctx->restart_index);
       }
    }
 }
@@ -121,10 +119,8 @@ emit_vertices_i16(struct push_context *ctx, unsigned start, unsigned count)
       if (nr != push) {
          count--;
          elts++;
-         BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2);
-         OUT_RING  (ctx->chan, 0);
-         OUT_RING  (ctx->chan, NVA0_3D_VERTEX_BEGIN_GL_INSTANCE_CONT |
-                    (ctx->prim & ~NV50_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT));
+         BEGIN_RING(ctx->chan, RING_3D(VB_ELEMENT_U32), 1);
+         OUT_RING  (ctx->chan, ctx->restart_index);
       }
    }
 }
@@ -156,10 +152,8 @@ emit_vertices_i32(struct push_context *ctx, unsigned start, unsigned count)
       if (nr != push) {
          count--;
          elts++;
-         BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2);
-         OUT_RING  (ctx->chan, 0);
-         OUT_RING  (ctx->chan, NVA0_3D_VERTEX_BEGIN_GL_INSTANCE_CONT |
-                    (ctx->prim & ~NV50_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT));
+         BEGIN_RING(ctx->chan, RING_3D(VB_ELEMENT_U32), 1);
+         OUT_RING  (ctx->chan, ctx->restart_index);
       }
    }
 }
@@ -257,6 +251,17 @@ nv50_push_vbo(struct nv50_context *nv50, const struct pipe_draw_info *info)
    ctx.instance_id = info->start_instance;
    ctx.prim = nv50_prim_gl(info->mode);
 
+   if (info->primitive_restart) {
+      BEGIN_RING(ctx.chan, RING_3D(PRIM_RESTART_ENABLE), 2);
+      OUT_RING  (ctx.chan, 1);
+      OUT_RING  (ctx.chan, info->restart_index);
+   } else
+   if (nv50->state.prim_restart) {
+      BEGIN_RING(ctx.chan, RING_3D(PRIM_RESTART_ENABLE), 1);
+      OUT_RING  (ctx.chan, 0);
+   }
+   nv50->state.prim_restart = info->primitive_restart;
+
    while (inst--) {
       BEGIN_RING(ctx.chan, RING_3D(VERTEX_BEGIN_GL), 1);
       OUT_RING  (ctx.chan, ctx.prim);




More information about the mesa-commit mailing list