draw: fix prim ids when there's no gs
authorRoland Scheidegger <sroland@vmware.com>
Thu, 23 Apr 2015 16:13:32 +0000 (18:13 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Thu, 23 Apr 2015 16:14:22 +0000 (18:14 +0200)
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@vmware.com>
CC: <mesa-stable@lists.freedesktop.org>
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_prim_assembler.c
src/gallium/auxiliary/draw/draw_prim_assembler.h

index 04cf5b7630e984ebd72568a7d306d88edeee7382..ee009c1fb7191a9a161693d55715344724688bb8 100644 (file)
@@ -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);
 }
 
 
index 776c1726217386fe5e1b86e0d141ed8b4e9e85f6..7ff705a91a5ba7489291ea9907eb9799b69c9d00 100644 (file)
@@ -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;
+}
index 5ba715b8135ea760caedbfe4013d6ea562f45260..5ee731750f7de1538bcc2b649cb967d08538e6f5 100644 (file)
@@ -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