From 9542131b273d01d2c3403e6791172347cb792e34 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 17 Jun 2013 21:06:11 -0400 Subject: [PATCH] Revert "draw: clear the draw buffers in draw" This reverts commit 41966fdb3b71c0b70aeb095e0eb3c5626c144a3a. While it's a lot cleaner it causes regressions because the draw interface is always called from the draw functions of the drivers (because the buffers need to be mapped) which means that the stream output buffers endup being cleared on every draw rather than on setting. Signed-off-by: Zack Rusin --- src/gallium/auxiliary/draw/draw_context.c | 25 ++----------------- src/gallium/auxiliary/draw/draw_context.h | 3 +-- src/gallium/drivers/llvmpipe/lp_context.h | 1 - src/gallium/drivers/llvmpipe/lp_draw_arrays.c | 4 +-- src/gallium/drivers/llvmpipe/lp_state_so.c | 8 ++++-- src/gallium/drivers/softpipe/sp_context.h | 1 - src/gallium/drivers/softpipe/sp_draw_arrays.c | 4 +-- src/gallium/drivers/softpipe/sp_state_so.c | 1 - 8 files changed, 13 insertions(+), 34 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 201c62d945c..4a08765c94f 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -807,36 +807,15 @@ 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], - unsigned append_bitmask) + struct draw_so_target *targets[PIPE_MAX_SO_BUFFERS]) { 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 ae6306811f9..4a1b27ee414 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -231,8 +231,7 @@ 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], - unsigned append_bitmask); + struct draw_so_target *targets[PIPE_MAX_SO_BUFFERS]); /*********************************************************************** diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index 27e8b0134d0..ab520019f82 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -91,7 +91,6 @@ struct llvmpipe_context { struct draw_so_target *so_targets[PIPE_MAX_SO_BUFFERS]; int num_so_targets; - unsigned so_append_bitmask; struct pipe_query_data_so_statistics so_stats; unsigned num_primitives_generated; diff --git a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c index 11b665af8ef..4e239043ec4 100644 --- a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c +++ b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c @@ -104,7 +104,7 @@ llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) } } draw_set_mapped_so_targets(draw, lp->num_so_targets, - lp->so_targets, lp->so_append_bitmask); + lp->so_targets); llvmpipe_prepare_vertex_sampling(lp, lp->num_sampler_views[PIPE_SHADER_VERTEX], @@ -134,7 +134,7 @@ llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) if (mapped_indices) { draw_set_indexes(draw, NULL, 0, 0); } - draw_set_mapped_so_targets(draw, 0, NULL, 0); + draw_set_mapped_so_targets(draw, 0, NULL); if (lp->gs && !lp->gs->shader.tokens) { /* we have attached stream output to the vs for rendering, diff --git a/src/gallium/drivers/llvmpipe/lp_state_so.c b/src/gallium/drivers/llvmpipe/lp_state_so.c index c20ff26639d..fa58f79c9c1 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_so.c +++ b/src/gallium/drivers/llvmpipe/lp_state_so.c @@ -70,13 +70,17 @@ llvmpipe_set_so_targets(struct pipe_context *pipe, int i; for (i = 0; i < num_targets; i++) { pipe_so_target_reference((struct pipe_stream_output_target **)&llvmpipe->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)) && llvmpipe->so_targets[i]) { + llvmpipe->so_targets[i]->internal_offset = 0; + llvmpipe->so_targets[i]->emitted_vertices = 0; + } } for (; i < llvmpipe->num_so_targets; i++) { pipe_so_target_reference((struct pipe_stream_output_target **)&llvmpipe->so_targets[i], NULL); } - - llvmpipe->so_append_bitmask = append_bitmask; llvmpipe->num_so_targets = num_targets; } diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index d7a00b95b25..e8de81a4c70 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -88,7 +88,6 @@ struct softpipe_context { struct draw_so_target *so_targets[PIPE_MAX_SO_BUFFERS]; unsigned num_so_targets; - unsigned so_append_bitmask; struct pipe_query_data_so_statistics so_stats; unsigned num_primitives_generated; diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c index cde4d51c734..45b1390de4d 100644 --- a/src/gallium/drivers/softpipe/sp_draw_arrays.c +++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c @@ -112,7 +112,7 @@ softpipe_draw_vbo(struct pipe_context *pipe, } draw_set_mapped_so_targets(draw, sp->num_so_targets, - sp->so_targets, sp->so_append_bitmask); + sp->so_targets); if (sp->gs && !sp->gs->shader.tokens) { /* we have an empty geometry shader with stream output, so @@ -135,7 +135,7 @@ softpipe_draw_vbo(struct pipe_context *pipe, draw_set_indexes(draw, NULL, 0, 0); } - draw_set_mapped_so_targets(draw, 0, NULL, 0); + draw_set_mapped_so_targets(draw, 0, NULL); /* * TODO: Flush only when a user vertex/index buffer is present diff --git a/src/gallium/drivers/softpipe/sp_state_so.c b/src/gallium/drivers/softpipe/sp_state_so.c index 96bb6b17ae8..3682c6c6742 100644 --- a/src/gallium/drivers/softpipe/sp_state_so.c +++ b/src/gallium/drivers/softpipe/sp_state_so.c @@ -77,7 +77,6 @@ softpipe_set_so_targets(struct pipe_context *pipe, } softpipe->num_so_targets = num_targets; - softpipe->so_append_bitmask = append_bitmask; } void -- 2.30.2