summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_state_vs.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-05-17 10:07:46 -0600
committerBrian Paul <brianp@vmware.com>2012-05-19 08:28:56 -0600
commitfc71e0b4a8623dc1e0657a19998f54d5a5c491e1 (patch)
tree421fe1be0db05a5ad33840711f0013696a720b85 /src/gallium/drivers/svga/svga_state_vs.c
parent0161691f3518db310411c5f02c05aa639050f129 (diff)
downloadexternal_mesa3d-fc71e0b4a8623dc1e0657a19998f54d5a5c491e1.zip
external_mesa3d-fc71e0b4a8623dc1e0657a19998f54d5a5c491e1.tar.gz
external_mesa3d-fc71e0b4a8623dc1e0657a19998f54d5a5c491e1.tar.bz2
svga: fix zero-stride vertex array bug
For zero-stride vertex arrays, the svga driver copies the value into the constant value and uses that value in the shader. The recent gallium-userbuf changes caused a regression in this. An example symptom was per-primitive glColor3f() calls getting ignored. Where we copied the vertex value from the vertex buffer to the constant buffer we neglected to take into account the pipe_vertex_buffer::buffer_offset field. Adding that value to the source offset fixes the problem. Actually, it looks like we should have been doing this all along, but it never was an issue before for some reason.
Diffstat (limited to 'src/gallium/drivers/svga/svga_state_vs.c')
-rw-r--r--src/gallium/drivers/svga/svga_state_vs.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c
index 3cb0cdb..1d140bd 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -222,7 +222,11 @@ struct svga_tracked_state svga_hw_vs =
};
-/***********************************************************************
+/**
+ * This function handles the special case of vertex attributes
+ * with stride=0. Basically, copy those values into the constant
+ * buffer and modify the vertex shader to get the values from the
+ * constant buffer rather than a vertex array.
*/
static enum pipe_error
update_zero_stride( struct svga_context *svga,
@@ -269,7 +273,7 @@ update_zero_stride( struct svga_context *svga,
mapped_buffer = pipe_buffer_map_range(&svga->pipe,
vbuffer->buffer,
- vel->src_offset,
+ vel->src_offset + vbuffer->buffer_offset,
util_format_get_blocksize(vel->src_format),
PIPE_TRANSFER_READ,
&transfer);