panfrost: Allocate XFB buffers per-instance
authorAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 7 Jun 2021 19:25:49 +0000 (15:25 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 10 Jun 2021 18:06:10 +0000 (18:06 +0000)
Somehow XFB gets so little use we never noticed. Fixes:

   KHR-GLES31.core.vertex_attrib_binding.basic-input-case9
   KHR-GLES31.core.vertex_attrib_binding.basic-input-case11
   KHR-GLES31.core.vertex_attrib_binding.basic-inputI-case2

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>

src/gallium/drivers/panfrost/pan_cmdstream.c

index bb91b3e..dc62c73 100644 (file)
@@ -2291,10 +2291,11 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
         /* Suppress prefetch on Bifrost */
         memset(varyings + (xfb_base * ctx->streamout.num_targets), 0, sizeof(*varyings));
 
-        /* Emit the stream out buffers */
+        /* Emit the stream out buffers. We need enough room for all the
+         * vertices we emit across all instances */
 
-        unsigned out_count = u_stream_outputs_for_vertices(ctx->active_prim,
-                                                           ctx->vertex_count);
+        unsigned out_count = ctx->instance_count *
+                u_stream_outputs_for_vertices(ctx->active_prim, ctx->vertex_count);
 
         for (unsigned i = 0; i < ctx->streamout.num_targets; ++i) {
                 panfrost_emit_streamout(batch, &varyings[xfb_base + i],