From: Erik Faye-Lund Date: Tue, 7 May 2019 10:13:43 +0000 (+0200) Subject: softpipe: pass stream-out targets to draw-module early X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d59c961af9eb48b61c0e078a71b3e8ca95a06778;p=mesa.git softpipe: pass stream-out targets to draw-module early This is essensially a port of ed53e61bec9 from LLVMpipe to softpipe, as it makes things a bit simpler and more performant. Signed-off-by: Erik Faye-Lund Reviewed-By: Gert Wollny --- diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c index 6363701cf92..91427348a25 100644 --- a/src/gallium/drivers/softpipe/sp_draw_arrays.c +++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c @@ -109,18 +109,6 @@ softpipe_draw_vbo(struct pipe_context *pipe, info->index_size, available_space); } - - for (i = 0; i < sp->num_so_targets; i++) { - void *buf = 0; - if (sp->so_targets[i]) { - buf = softpipe_resource(sp->so_targets[i]->target.buffer)->data; - sp->so_targets[i]->mapping = buf; - } - } - - draw_set_mapped_so_targets(draw, sp->num_so_targets, - sp->so_targets); - if (softpipe_screen(sp->pipe.screen)->use_llvm) { softpipe_prepare_vertex_sampling(sp, sp->num_sampler_views[PIPE_SHADER_VERTEX], @@ -151,8 +139,6 @@ softpipe_draw_vbo(struct pipe_context *pipe, draw_set_indexes(draw, NULL, 0, 0); } - draw_set_mapped_so_targets(draw, 0, NULL); - if (softpipe_screen(sp->pipe.screen)->use_llvm) { softpipe_cleanup_vertex_sampling(sp); softpipe_cleanup_geometry_sampling(sp); diff --git a/src/gallium/drivers/softpipe/sp_state_so.c b/src/gallium/drivers/softpipe/sp_state_so.c index 3878e4a5389..aa2f11880dd 100644 --- a/src/gallium/drivers/softpipe/sp_state_so.c +++ b/src/gallium/drivers/softpipe/sp_state_so.c @@ -70,6 +70,11 @@ softpipe_set_so_targets(struct pipe_context *pipe, for (i = 0; i < num_targets; i++) { pipe_so_target_reference((struct pipe_stream_output_target **)&softpipe->so_targets[i], targets[i]); + + if (targets[i]) { + void *buf = softpipe_resource(targets[i]->buffer)->data; + softpipe->so_targets[i]->mapping = buf; + } } for (; i < softpipe->num_so_targets; i++) { @@ -77,6 +82,9 @@ softpipe_set_so_targets(struct pipe_context *pipe, } softpipe->num_so_targets = num_targets; + + draw_set_mapped_so_targets(softpipe->draw, softpipe->num_so_targets, + softpipe->so_targets); } void @@ -86,4 +94,3 @@ softpipe_init_streamout_funcs(struct pipe_context *pipe) pipe->stream_output_target_destroy = softpipe_so_target_destroy; pipe->set_stream_output_targets = softpipe_set_so_targets; } -