st/mesa: skip draw calls with pipe_draw_info::count == 0
authorMarek Olšák <marek.olsak@amd.com>
Fri, 1 Sep 2017 21:27:35 +0000 (23:27 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 7 Sep 2017 10:34:28 +0000 (12:34 +0200)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102502

Cc: 17.2 <mesa-stable@lists.freedesktop.org>
Tested-by: Alexandre Demers <alexandre.f.demers@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/state_tracker/st_draw.c

index fe03a4a587eb9a57b9fb2dea36b4fe1bc098a1b9..2fe7070bcae91afd2d34583c056fe941c6986550 100644 (file)
@@ -198,9 +198,14 @@ st_draw_vbo(struct gl_context *ctx,
 
    /* do actual drawing */
    for (i = 0; i < nr_prims; i++) {
+      info.count = prims[i].count;
+
+      /* Skip no-op draw calls. */
+      if (!info.count && !tfb_vertcount)
+         continue;
+
       info.mode = translate_prim(ctx, prims[i].mode);
       info.start = start + prims[i].start;
-      info.count = prims[i].count;
       info.start_instance = prims[i].base_instance;
       info.instance_count = prims[i].num_instances;
       info.index_bias = prims[i].basevertex;