summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50/nv50_vbo.c
diff options
context:
space:
mode:
authorMarcin Slusarz <[email protected]>2012-06-19 23:38:34 +0200
committerMarcin Slusarz <[email protected]>2012-06-20 21:24:53 +0200
commit19fd04f5eaf76f6ea5effa69d91c415bba75ba8e (patch)
tree45468a40cf531e83a5d774683cfac4c390551c8c /src/gallium/drivers/nv50/nv50_vbo.c
parent7e63b613a5a067462c450338e0bdce5b5976f6f1 (diff)
nv50: fix buffer reuse issues
1) We need to insert a barrier between consecutive transform feedback calls. 2) VBO cache needs to be flushed when TFB output is used as VBO draw input. Fixes Piglit test EXT_transform_feedback/immediate-reuse. Thanks to Christoph Bumiller for pointing out bugs in previous versions of this patch.
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_vbo.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_vbo.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index 1875d4d6092..6e81b7b2d34 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -293,6 +293,18 @@ nv50_vertex_arrays_validate(struct nv50_context *nv50)
else
nv50->vbo_fifo = 0;
+ if (!nv50->vbo_fifo) {
+ /* if vertex buffer was written by GPU - flush VBO cache */
+ for (i = 0; i < nv50->num_vtxbufs; ++i) {
+ struct nv04_resource *buf = nv04_resource(nv50->vtxbuf[i].buffer);
+ if (buf && buf->status & NOUVEAU_BUFFER_STATUS_GPU_WRITING) {
+ buf->status &= ~NOUVEAU_BUFFER_STATUS_GPU_WRITING;
+ nv50->base.vbo_dirty = TRUE;
+ break;
+ }
+ }
+ }
+
/* update vertex format state */
BEGIN_NV04(push, NV50_3D(VERTEX_ARRAY_ATTRIB(0)), n);
if (nv50->vbo_fifo) {