freedreno: Don't count primitives for patches
authorKristian H. Kristensen <hoegsberg@google.com>
Tue, 22 Oct 2019 23:24:26 +0000 (16:24 -0700)
committerKristian H. Kristensen <hoegsberg@google.com>
Fri, 8 Nov 2019 00:36:47 +0000 (16:36 -0800)
The gallium helper doesn't like patches and we can't determine how
many primitives it gets tessellated into anyway.  On gens where we
have tessellation, we get the prim count from a HW counter so just
skip counting on the CPU.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/freedreno_draw.c

index 059de2ec8c612dcf9f1165bd4adc834f3b5a73a7..b738498c56baabdd7465c33ff05a17b596c85fc3 100644 (file)
@@ -256,7 +256,14 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
 
        batch->num_draws++;
 
-       prims = u_reduced_prims_for_vertices(info->mode, info->count);
+       /* Counting prims in sw doesn't work for GS and tesselation. For older
+        * gens we don't have those stages and don't have the hw counters enabled,
+        * so keep the count accurate for non-patch geometry.
+        */
+       if (info->mode != PIPE_PRIM_PATCHES)
+               prims = u_reduced_prims_for_vertices(info->mode, info->count);
+       else
+               prims = 0;
 
        ctx->stats.draw_calls++;