summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_draw.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-07-07 10:08:43 -0600
committerBrian Paul <[email protected]>2008-07-07 10:10:20 -0600
commitb7dfabcaab020e89644f47ec243b231c21fece63 (patch)
treec6fd4856db920a1557551004b3f51bd520f98338 /src/mesa/state_tracker/st_draw.c
parent3596339d31d05b7d5120290a7b866485c395b5f2 (diff)
gallium: simplify/fix buffer_offset, src_offset computation for VBO arrays
Things broke when vertex position wasn't the first attribute.
Diffstat (limited to 'src/mesa/state_tracker/st_draw.c')
-rw-r--r--src/mesa/state_tracker/st_draw.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 21911774d79..32913879298 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -300,8 +300,8 @@ st_draw_vbo(GLcontext *ctx,
vbuffer[attr].buffer = NULL;
pipe_reference_buffer(pipe, &vbuffer[attr].buffer, stobj->buffer);
- vbuffer[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
- velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
+ vbuffer[attr].buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
+ velements[attr].src_offset = 0;
assert(velements[attr].src_offset <= 2048); /* 11-bit field */
}
else {
@@ -335,6 +335,25 @@ st_draw_vbo(GLcontext *ctx,
assert(velements[attr].src_format);
}
+#if 0
+ {
+ GLuint i;
+ char buf[100];
+ for (i = 0; i < vp->num_inputs; i++) {
+ printf("buffers[%d].pitch = %u\n", i, vbuffer[i].pitch);
+ printf("buffers[%d].max_index = %u\n", i, vbuffer[i].max_index);
+ printf("buffers[%d].buffer_offset = %u\n", i, vbuffer[i].buffer_offset);
+ printf("buffers[%d].buffer = %p\n", i, (void*) vbuffer[i].buffer);
+ }
+ for (i = 0; i < vp->num_inputs; i++) {
+ printf("vlements[%d].src_offset = %u\n", i, velements[i].src_offset);
+ printf("vlements[%d].vbuffer_index = %u\n", i, velements[i].vertex_buffer_index);
+ printf("vlements[%d].nr_comps = %u\n", i, velements[i].nr_components);
+ printf("vlements[%d].format = %s\n", i, pf_sprint_name(buf, velements[i].src_format));
+ }
+ }
+#endif
+
pipe->set_vertex_buffers(pipe, vp->num_inputs, vbuffer);
pipe->set_vertex_elements(pipe, vp->num_inputs, velements);