Mesa (master): draw: reset the vertex id when injecting new primitive id

Zack Rusin zack at kemper.freedesktop.org
Fri Aug 9 00:58:36 UTC 2013


Module: Mesa
Branch: master
Commit: 1d425c4c6df2affd3b36b98e28357c59f7f02f58
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d425c4c6df2affd3b36b98e28357c59f7f02f58

Author: Zack Rusin <zackr at vmware.com>
Date:   Tue Aug  6 20:25:53 2013 -0400

draw: reset the vertex id when injecting new primitive id

Without reseting the vertex id, with primitives where the same
vertex is used with different primitives (e.g. tri/lines strips)
our vbuf module won't re-emit those vertices with the changed
primitive id. So lets reset the vertex id whenever injecting
new primitive id to make sure that the vertex data is correctly
emitted.

Signed-off-by: Zack Rusin <zackr at vmware.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>

---

 src/gallium/auxiliary/draw/draw_pipe_ia.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_ia.c b/src/gallium/auxiliary/draw/draw_pipe_ia.c
index ecbb233..d64f19b 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_ia.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_ia.c
@@ -68,6 +68,15 @@ inject_primid(struct draw_stage *stage,
 
    for (i = 0; i < num_verts; ++i) {
       struct vertex_header *v = header->v[i];
+      /* We have to reset the vertex_id because it's used by
+       * vbuf to figure out if the vertex had already been
+       * emitted. For line/tri strips the first vertex of
+       * subsequent primitives would already be emitted,
+       * but since we're changing the primitive id on the vertex
+       * we want to make sure it's reemitted with the correct
+       * data.
+       */
+      v->vertex_id = UNDEFINED_VERTEX_ID;
       memcpy(&v->data[slot][0], &primid, sizeof(primid));
       memcpy(&v->data[slot][1], &primid, sizeof(primid));
       memcpy(&v->data[slot][2], &primid, sizeof(primid));




More information about the mesa-commit mailing list