summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_draw.c
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2016-05-16 15:12:57 -0700
committerBrian Paul <[email protected]>2016-06-23 07:31:20 -0600
commitd4a77254cb491c8e4a90ecefb0c9ae430bb0278a (patch)
tree995199f9827a90a2594a96154e783936d7dafcbb /src/gallium/drivers/svga/svga_draw.c
parent2b81e31d4488ada643560a640aa4c0f6372e9ca7 (diff)
svga: fix index/vertex buffer surface reference at draw
Currently with the SetVertexBuffers optimization, we avoid emitting redundant DXSetVertexBuffers commands. However, these buffers surfaces will still need to be referenced, otherwise, in the case of linux, the subsequent surface discard map will map to the existing mob instead of a new one, causing rendering artifacts. With this patch, we'll call resource_rebind() to reference the resources even if we are avoiding the actual set command. This fixes the rendering artifacts in the window title area running with unity in Ubuntu 14.04 Tested with piglit, glretrace. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_draw.c')
-rw-r--r--src/gallium/drivers/svga/svga_draw.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c
index 872dd7f8954..600df892006 100644
--- a/src/gallium/drivers/svga/svga_draw.c
+++ b/src/gallium/drivers/svga/svga_draw.c
@@ -577,6 +577,17 @@ draw_vgpu10(struct svga_hwtnl *hwtnl,
}
}
}
+ else {
+ /* Even though we can avoid emitting the redundant SetVertexBuffers
+ * command, we still need to reference the vertex buffers surfaces.
+ */
+ for (i = 0; i < vbuf_count; i++) {
+ ret = svga->swc->resource_rebind(svga->swc, vbuffer_handles[i],
+ NULL, SVGA_RELOC_READ);
+ if (ret != PIPE_OK)
+ return ret;
+ }
+ }
}
/* Set primitive type (line, tri, etc) */
@@ -609,6 +620,15 @@ draw_vgpu10(struct svga_hwtnl *hwtnl,
svga->state.hw_draw.ib_format = indexFormat;
svga->state.hw_draw.ib_offset = range->indexArray.offset;
}
+ else {
+ /* Even though we can avoid emitting the redundant SetIndexBuffer
+ * command, we still need to reference the index buffer surface.
+ */
+ ret = svga->swc->resource_rebind(svga->swc, ib_handle,
+ NULL, SVGA_RELOC_READ);
+ if (ret != PIPE_OK)
+ return ret;
+ }
if (instance_count > 1) {
ret = SVGA3D_vgpu10_DrawIndexedInstanced(svga->swc,