summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-01-26 11:32:01 -0700
committerIan Romanick <ian.d.romanick@intel.com>2012-07-06 10:08:59 -0700
commit646ac024624ebc74ec540992507060968c3d9a4e (patch)
tree78145b81469adcda9914f51a4a709a61a27c27f7
parentdad7547b98dc4da4899ee883fa5c3c4f5698101a (diff)
downloadmesa-646ac024624ebc74ec540992507060968c3d9a4e.tar.gz
svga: reset vertex buffer offset in svga_release_user_upl_buffers()
This function releases the buffer that contains user-space vertex data. The buffer_offset field points into that buffer. So reset the buffer_offset to zero when we release the buffer so that subsequent draws don't inadvertantly get a bad offset. Fixes error messages / failed assertions (in the draw module's bounds/size checking code) when running piglit's polygon-mode test. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: José Fonseca <jfonseca@vmware.com> (cherry picked from commit 04341e51cea32d6e54d99019dd00ec56e77e27f9)
-rw-r--r--src/gallium/drivers/svga/svga_pipe_draw.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c
index 541a2340159..cc0df7187fb 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -201,6 +201,17 @@ svga_release_user_upl_buffers(struct svga_context *svga)
if (vb->buffer && svga_buffer_is_user_buffer(vb->buffer)) {
struct svga_buffer *buffer = svga_buffer(vb->buffer);
+ /* The buffer_offset is relative to the uploaded buffer.
+ * Since we're discarding that buffer we need to reset this offset
+ * so it's not inadvertantly applied to a subsequent draw.
+ *
+ * XXX a root problem here is that the svga->curr.vb[] information
+ * is getting set both by gallium API calls and by code in
+ * svga_upload_user_buffers(). We should instead have two copies
+ * of the vertex buffer information and choose between as needed.
+ */
+ vb->buffer_offset = 0;
+
buffer->uploaded.start = ~0;
buffer->uploaded.end = 0;
if (buffer->uploaded.buffer)