radeonsi: don't rebind GSVS ring buffers every draw call using GS

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
Marek Olšák 2015-08-29 02:02:29 +02:00
parent c9a3196b14
commit c2a42d1f9f
3 changed files with 10 additions and 3 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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);