diff options
author | Zack Rusin <[email protected]> | 2014-03-06 18:43:44 -0500 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2014-03-07 12:49:33 -0500 |
commit | dfa25ea5cd19d5a050a1c94bd7370a2259b9f007 (patch) | |
tree | 8ce2db3ceab01311df710c2d7f307f5b708312c5 /src/gallium/auxiliary/draw | |
parent | 7d5903980ed7c4405e20dbc4f5ade9d202c559cb (diff) |
gallium: allow setting of the internal stream output offset
D3D10 allows setting of the internal offset of a buffer, which is
in general only incremented via actual stream output writes. By
allowing setting of the internal offset draw_auto is capable
of rendering from buffers which have not been actually streamed
out to. Our interface didn't allow. This change functionally
shouldn't make any difference to OpenGL where instead of an
append_bitmask you just get a real array where -1 means append
(like in D3D) and 0 means do not append.
Signed-off-by: Zack Rusin <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_context.h | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt_so_emit.c | 3 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index c9f933c7017..f114f503546 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -53,14 +53,13 @@ struct tgsi_sampler; * structure to contain driver internal information * for stream out support. mapping stores the pointer * to the buffer contents, and internal offset stores - * stores an internal counter to how much of the stream + * an internal counter to how much of the stream * out buffer is used (in bytes). */ struct draw_so_target { struct pipe_stream_output_target target; void *mapping; int internal_offset; - int emitted_vertices; }; struct draw_context *draw_create( struct pipe_context *pipe ); diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index e2ff7f9fe9f..3236e523a94 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -431,14 +431,16 @@ draw_pt_arrays_restart(struct draw_context *draw, */ static void resolve_draw_info(const struct pipe_draw_info *raw_info, - struct pipe_draw_info *info) + struct pipe_draw_info *info, + struct pipe_vertex_buffer *vertex_buffer) { memcpy(info, raw_info, sizeof(struct pipe_draw_info)); if (raw_info->count_from_stream_output) { struct draw_so_target *target = (struct draw_so_target *)info->count_from_stream_output; - info->count = target->emitted_vertices; + assert(vertex_buffer != NULL); + info->count = target->internal_offset / vertex_buffer->stride; /* Stream output draw can not be indexed */ debug_assert(!info->indexed); @@ -467,7 +469,7 @@ draw_vbo(struct draw_context *draw, */ util_fpstate_set_denorms_to_zero(fpstate); - resolve_draw_info(info, &resolved_info); + resolve_draw_info(info, &resolved_info, &(draw->pt.vertex_buffer[0])); info = &resolved_info; assert(info->instance_count > 0); diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c b/src/gallium/auxiliary/draw/draw_pt_so_emit.c index 7cef17c7cf9..bd49d0adec6 100644 --- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c @@ -194,7 +194,7 @@ static void so_emit_prim(struct pt_so_emit *so, { int j; debug_printf("VERT[%d], offset = %d, slot[%d] sc = %d, num_c = %d, idx = %d = [", - i + draw->so.targets[ob]->emitted_vertices, + i, draw->so.targets[ob]->internal_offset, slot, start_comp, num_comps, idx); for (j = 0; j < num_comps; ++j) { @@ -209,7 +209,6 @@ static void so_emit_prim(struct pt_so_emit *so, struct draw_so_target *target = draw->so.targets[ob]; if (target && buffer_written[ob]) { target->internal_offset += state->stride[ob] * sizeof(float); - target->emitted_vertices += 1; } } } |