Mesa (10.5): draw: fix prim ids when there's no gs

Emil Velikov evelikov at kemper.freedesktop.org
Wed May 6 13:27:10 UTC 2015


Module: Mesa
Branch: 10.5
Commit: cf60503378f75ef2e9079092a0e6d26a589336dc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf60503378f75ef2e9079092a0e6d26a589336dc

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Thu Apr 23 18:13:32 2015 +0200

draw: fix prim ids when there's no gs

We were resetting the prim id count for each run of the prim assembler,
hence this only worked when the draw calls were very small (the exact limit
depending on the vertex size), since larger draw calls get split up.
So, do the same as we do already if there's a gs, reset it to zero explicitly
for every new instance (this possibly could use the same variable but that
isn't doable without some heavy refactoring and I'm not sure it makes sense).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90130.

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

CC: <mesa-stable at lists.freedesktop.org>
(cherry picked from commit f2a7fd9943fcb7d3de3bc2b21907e0a157b88e96)

---

 src/gallium/auxiliary/draw/draw_context.c        |    1 +
 src/gallium/auxiliary/draw/draw_prim_assembler.c |   13 +++++++++++--
 src/gallium/auxiliary/draw/draw_prim_assembler.h |    3 +++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 04cf5b7..ee009c1 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -182,6 +182,7 @@ boolean draw_init(struct draw_context *draw)
 void draw_new_instance(struct draw_context *draw)
 {
    draw_geometry_shader_new_instance(draw->gs.geometry_shader);
+   draw_prim_assembler_new_instance(draw->ia);
 }
 
 
diff --git a/src/gallium/auxiliary/draw/draw_prim_assembler.c b/src/gallium/auxiliary/draw/draw_prim_assembler.c
index 776c172..7ff705a 100644
--- a/src/gallium/auxiliary/draw/draw_prim_assembler.c
+++ b/src/gallium/auxiliary/draw/draw_prim_assembler.c
@@ -189,7 +189,6 @@ draw_prim_assembler_prepare_outputs(struct draw_assembler *ia)
    } else {
       ia->primid_slot = -1;
    }
-   ia->primid = 0;
 }
 
 
@@ -233,7 +232,6 @@ draw_prim_assembler_run(struct draw_context *draw,
    asmblr->input_prims = input_prims;
    asmblr->input_verts = input_verts;
    asmblr->needs_primid = needs_primid(asmblr->draw);
-   asmblr->primid = 0;
    asmblr->num_prims = 0;
 
    output_prims->linear = TRUE;
@@ -284,3 +282,14 @@ draw_prim_assembler_destroy(struct draw_assembler *ia)
 {
    FREE(ia);
 }
+
+
+/*
+ * Called at the very begin of the draw call with a new instance
+ * Used to reset state that should persist between primitive restart.
+ */
+void
+draw_prim_assembler_new_instance(struct draw_assembler *asmblr)
+{
+   asmblr->primid = 0;
+}
diff --git a/src/gallium/auxiliary/draw/draw_prim_assembler.h b/src/gallium/auxiliary/draw/draw_prim_assembler.h
index 5ba715b..5ee7317 100644
--- a/src/gallium/auxiliary/draw/draw_prim_assembler.h
+++ b/src/gallium/auxiliary/draw/draw_prim_assembler.h
@@ -70,5 +70,8 @@ draw_prim_assembler_run(struct draw_context *draw,
 void
 draw_prim_assembler_prepare_outputs(struct draw_assembler *ia);
 
+void
+draw_prim_assembler_new_instance(struct draw_assembler *ia);
+
 
 #endif




More information about the mesa-commit mailing list