radeonsi/gfx10: clean up ESGS ring size computation
authorMarek Olšák <marek.olsak@amd.com>
Sat, 6 Jul 2019 02:19:47 +0000 (22:19 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 20 Jul 2019 00:16:19 +0000 (20:16 -0400)
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
src/gallium/drivers/radeonsi/si_shader.c

index de02997..74be6df 100644 (file)
@@ -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;
index 8f392d6..75f2c24 100644 (file)
@@ -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;
        }