From: Marek Olšák Date: Sat, 6 Jul 2019 02:19:47 +0000 (-0400) Subject: radeonsi/gfx10: clean up ESGS ring size computation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1b4354dab9f81c92ff83f98d8d65e3c9d304d421;p=mesa.git radeonsi/gfx10: clean up ESGS ring size computation Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Samuel Pitoiset --- diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c index de0299740f8..74be6df30f9 100644 --- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c +++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c @@ -1328,6 +1328,14 @@ void gfx10_ngg_calculate_subgroup_info(struct si_shader *shader) * after culling is implemented. */ if (es_sel->so.num_outputs) esvert_lds_size = 4 * es_sel->info.num_outputs + 1; + + /* GS stores Primitive IDs into LDS at the address corresponding + * to the ES thread of the provoking vertex. All ES threads + * load and export PrimitiveID for their thread. + */ + if (gs_sel->type == PIPE_SHADER_VERTEX && + shader->key.mono.u.vs_export_prim_id) + esvert_lds_size = MAX2(esvert_lds_size, 1); } unsigned max_gsprims = max_gsprims_base; diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 8f392d640fe..75f2c241d33 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -5234,36 +5234,15 @@ static bool si_shader_binary_open(struct si_screen *screen, struct ac_rtld_symbol lds_symbols[2]; unsigned num_lds_symbols = 0; - unsigned esgs_ring_size = 0; - if (sel && screen->info.chip_class >= GFX9 && - sel->type == PIPE_SHADER_GEOMETRY && !shader->is_gs_copy_shader) { - esgs_ring_size = shader->gs_info.esgs_ring_size; - } - - if (sel && shader->key.as_ngg) { - if (sel->type != PIPE_SHADER_GEOMETRY && sel->so.num_outputs) { - unsigned esgs_vertex_bytes = 4 * (4 * sel->info.num_outputs + 1); - esgs_ring_size = MAX2(esgs_ring_size, - shader->ngg.max_out_verts * esgs_vertex_bytes); - } - - /* GS stores Primitive IDs into LDS at the address corresponding - * to the ES thread of the provoking vertex. All ES threads - * load and export PrimitiveID for their thread. - */ - if (sel->type == PIPE_SHADER_VERTEX && - shader->key.mono.u.vs_export_prim_id) - esgs_ring_size = MAX2(esgs_ring_size, shader->ngg.max_out_verts * 4); - } - - if (esgs_ring_size) { + if (sel && screen->info.chip_class >= GFX9 && !shader->is_gs_copy_shader && + (sel->type == PIPE_SHADER_GEOMETRY || shader->key.as_ngg)) { /* We add this symbol even on LLVM <= 8 to ensure that * shader->config.lds_size is set correctly below. */ struct ac_rtld_symbol *sym = &lds_symbols[num_lds_symbols++]; sym->name = "esgs_ring"; - sym->size = esgs_ring_size; + sym->size = shader->gs_info.esgs_ring_size; sym->align = 64 * 1024; }