freedreno/a6xx: fix vsc assert
authorRob Clark <robdclark@chromium.org>
Mon, 18 May 2020 21:14:51 +0000 (14:14 -0700)
committerMarge Bot <eric+marge@anholt.net>
Fri, 29 May 2020 19:35:08 +0000 (19:35 +0000)
Fixes a debug build assert seeing with an android app.  Not quite sure
which path was passing us draw_info w/ instance_count==0.  But we should
just treat non-instanced draws as having a single instance.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5091>

src/gallium/drivers/freedreno/a6xx/fd6_vsc.c

index daf97fe48acfa0fbf3282ea9dcc5ec1abe2d33f3..43b8c2753a92dffed0b13fa10c759065ca2a4836 100644 (file)
@@ -114,12 +114,11 @@ draw_stream_size_bits(const struct pipe_draw_info *info, unsigned num_bins,
                unsigned prim_strm_bits)
 {
        unsigned ndwords = prim_strm_bits / dword;
-       assert(info->instance_count > 0);
        return (bitfield_size_bits(num_bins)    /* bitfield of bins */
                        + 1                             /* last-instance-bit */
                        + number_size_bits(ndwords)     /* size of corresponding prim strm */
                        + 1                             /* checksum */
-                       ) * info->instance_count;
+                       ) * MAX2(1, info->instance_count);
 }
 
 void