From 41966fdb3b71c0b70aeb095e0eb3c5626c144a3a Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 13 Jun 2013 17:57:47 -0400 Subject: draw: clear the draw buffers in draw Moves clearing of the draw so target buffers to the draw module. They had to be cleared in the drivers before which was quite messy. Signed-off-by: Zack Rusin Reviewed-by: Jose Fonseca Reviewed-by: Brian Paul --- src/gallium/auxiliary/draw/draw_context.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src/gallium/auxiliary/draw/draw_context.c') diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 22c0e9be998..1fc6dbabc25 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -806,15 +806,36 @@ draw_get_rasterizer_no_cull( struct draw_context *draw, return draw->rasterizer_no_cull[scissor][flatshade]; } +/** + * Sets the mapped so targets. + * + * The append bitmask specifies which of the buffers are in + * the append mode. The append mode means that the buffer + * should be appended to, rather than written to from the start. + * i.e. the outputs should be written starting from the last + * location to which the previous + * pass of stream output wrote to in this buffer. + * If the buffer is not in an append mode (which is more common) + * the writing begins from the start of the buffer. + * + */ void draw_set_mapped_so_targets(struct draw_context *draw, int num_targets, - struct draw_so_target *targets[PIPE_MAX_SO_BUFFERS]) + struct draw_so_target *targets[PIPE_MAX_SO_BUFFERS], + unsigned append_bitmask) { int i; - for (i = 0; i < num_targets; i++) + for (i = 0; i < num_targets; i++) { draw->so.targets[i] = targets[i]; + /* if we're not appending then lets reset the internal + data of our so target */ + if (!(append_bitmask & (1 << i)) && draw->so.targets[i]) { + draw->so.targets[i]->internal_offset = 0; + draw->so.targets[i]->emitted_vertices = 0; + } + } for (i = num_targets; i < PIPE_MAX_SO_BUFFERS; i++) draw->so.targets[i] = NULL; -- cgit v1.2.3