v3d: flush jobs writing to vertex buffers used in the current draw call
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 19 Jun 2019 08:28:12 +0000 (10:28 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Fri, 21 Jun 2019 06:06:13 +0000 (08:06 +0200)
This can happen when any of our vertex buffers was written by a previous
transform feedback draw.

Fixes the following piglit tests:
spec/ext_transform_feedback/position-render-bufferbase
spec/ext_transform_feedback/position-render-bufferbase-discard
spec/ext_transform_feedback/position-render-bufferoffset
spec/ext_transform_feedback/position-render-bufferoffset-discard
spec/ext_transform_feedback/position-render-bufferrange
spec/ext_transform_feedback/position-render-bufferrange-discard

Reviewed-by: Eric Anholt <eric@anholt.net>
src/gallium/drivers/v3d/v3dx_draw.c

index 98f630766ca9d62a1d7064804f2b5be4660fa2e2..fe07231d4744287187df0fbd99e87989e619340d 100644 (file)
@@ -177,6 +177,15 @@ v3d_predraw_check_stage_inputs(struct pipe_context *pctx,
 
                 v3d_flush_jobs_writing_resource(v3d, view->base.resource);
         }
+
+        /* Flush writes to our vertex buffers (i.e. from transform feedback) */
+        if (s == PIPE_SHADER_VERTEX) {
+                foreach_bit(i, v3d->vertexbuf.enabled_mask) {
+                        struct pipe_vertex_buffer *vb = &v3d->vertexbuf.vb[i];
+
+                        v3d_flush_jobs_writing_resource(v3d, vb->buffer.resource);
+                }
+        }
 }
 
 static void