From: Marek Olšák Date: Sat, 29 Aug 2015 00:02:29 +0000 (+0200) Subject: radeonsi: don't rebind GSVS ring buffers every draw call using GS X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2a42d1f9ff104c562822d7ab2cbaa361666266b;p=mesa.git radeonsi: don't rebind GSVS ring buffers every draw call using GS Reviewed-by: Alex Deucher Acked-by: Christian König --- diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 9fe17985290..47ad619ccdc 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -234,6 +234,7 @@ struct si_context { int last_rast_prim; unsigned last_sc_line_stipple; int current_rast_prim; /* primitive type after TES, GS */ + unsigned last_gsvs_itemsize; /* Scratch buffer */ boolean emit_scratch_reloc; diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index c748f71430b..2305b9988b8 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -185,6 +185,7 @@ struct si_shader_selector { unsigned gs_output_prim; unsigned gs_max_out_vertices; unsigned gs_num_invocations; + unsigned gsvs_itemsize; /* masks of "get_unique_index" bits */ uint64_t inputs_read; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index a4c33fa6202..af91af97ce8 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -679,6 +679,8 @@ static void *si_create_shader_state(struct pipe_context *ctx, sel->info.properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES]; sel->gs_num_invocations = sel->info.properties[TGSI_PROPERTY_GS_INVOCATIONS]; + sel->gsvs_itemsize = sel->info.num_outputs * 16 * + sel->gs_max_out_vertices; for (i = 0; i < sel->info.num_inputs; i++) { unsigned name = sel->info.input_semantic_name[i]; @@ -1096,11 +1098,14 @@ static void si_init_gs_rings(struct si_context *sctx) static void si_update_gs_rings(struct si_context *sctx) { - unsigned gs_vert_itemsize = sctx->gs_shader->info.num_outputs * 16; - unsigned gs_max_vert_out = sctx->gs_shader->gs_max_out_vertices; - unsigned gsvs_itemsize = gs_vert_itemsize * gs_max_vert_out; + unsigned gsvs_itemsize = sctx->gs_shader->gsvs_itemsize; uint64_t offset; + if (gsvs_itemsize == sctx->last_gsvs_itemsize) + return; + + sctx->last_gsvs_itemsize = gsvs_itemsize; + si_set_ring_buffer(&sctx->b.b, PIPE_SHADER_GEOMETRY, SI_RING_GSVS, sctx->gsvs_ring, gsvs_itemsize, 64, true, true, 4, 16, 0);