summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-06-13 17:57:47 -0400
committerZack Rusin <[email protected]>2013-06-17 11:06:39 -0400
commit41966fdb3b71c0b70aeb095e0eb3c5626c144a3a (patch)
tree086d16f5c1acca677050acf06c782521e591dcc5 /src/gallium/auxiliary/draw
parent98bc4c62a621fa1f8c099c45767d22e5d2bc9741 (diff)
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 <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c25
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h3
2 files changed, 25 insertions, 3 deletions
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;
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 4a1b27ee414..ae6306811f9 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -231,7 +231,8 @@ draw_set_mapped_constant_buffer(struct draw_context *draw,
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);
/***********************************************************************