summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2010-06-16 15:56:17 -0400
committerZack Rusin <zackr@vmware.com>2010-06-16 15:56:17 -0400
commit638a80bc075a4b58123cb9ba03993bd8bfd024cd (patch)
treec6191da1f420050f897793d58ec93022262d47ac /src/gallium/auxiliary/draw
parent509ff13d068eea38fc5e8be52beb55ad7cfdf92f (diff)
draw: make sure we correctly iterate over output buffers on stream out
we kept overwriting the first attribute of a vertex in a single-stream- out-buffer case
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_so_emit.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
index 1877afbc3f..720c105ea1 100644
--- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
@@ -124,14 +124,15 @@ static void so_emit_prim(struct pt_so_emit *so,
for (i = 0; i < num_vertices; ++i) {
const float (*input)[4];
+ unsigned total_written_compos = 0;
/*debug_printf("%d) vertex index = %d (prim idx = %d)\n", i, indices[i], prim_idx);*/
input = (const float (*)[4])(
(const char *)input_ptr + (indices[i] * input_vertex_stride));
for (slot = 0; slot < state->num_outputs; ++slot) {
unsigned idx = state->register_index[slot];
unsigned writemask = state->register_mask[slot];
- unsigned compo;
unsigned written_compos = 0;
+ unsigned compo;
buffer = (float**)&so->buffers[state->output_buffer[slot]];
@@ -157,11 +158,16 @@ static void so_emit_prim(struct pt_so_emit *so,
input[idx][2],
input[idx][3]);
#endif
- if (!so->single_buffer)
- *buffer += written_compos;
+ *buffer += written_compos;
+ total_written_compos += written_compos;
+ }
+ if (so->single_buffer) {
+ unsigned stride = state->stride -
+ sizeof(float) * total_written_compos;
+
+ debug_assert(stride >= 0);
+ *buffer = (float*) (((char*)*buffer) + stride);
}
- if (so->single_buffer)
- *buffer = (float*) (((char*)*buffer) + state->stride);
}
so->emitted_vertices += num_vertices;
++so->emitted_primitives;