move: move ngg lds bytes determination earlier

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13134>
This commit is contained in:
Samuel Pitoiset
2021-10-01 09:49:43 +02:00
committed by Marge Bot
parent 90858dd718
commit 2ce78a30ff
4 changed files with 12 additions and 6 deletions

View File

@@ -93,7 +93,6 @@ ac_nir_lower_indirect_derefs(nir_shader *shader,
typedef struct
{
unsigned lds_bytes_if_culling_off;
bool passthrough;
uint64_t nggc_inputs_read_by_pos;
uint64_t nggc_inputs_read_by_others;

View File

@@ -1301,9 +1301,6 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
if (shader->info.stage == MESA_SHADER_VERTEX && export_prim_id)
state.total_lds_bytes = max_num_es_vertices * 4u;
/* The shader only needs this much LDS when culling is turned off. */
unsigned lds_bytes_if_culling_off = state.total_lds_bytes;
nir_builder builder;
nir_builder *b = &builder; /* This is to avoid the & */
nir_builder_init(b, impl);
@@ -1418,7 +1415,6 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
shader->info.shared_size = state.total_lds_bytes;
ac_nir_ngg_config ret = {
.lds_bytes_if_culling_off = lds_bytes_if_culling_off,
.passthrough = passthrough,
.nggc_inputs_read_by_pos = state.inputs_needed_by_pos,
.nggc_inputs_read_by_others = state.inputs_needed_by_others,

View File

@@ -2786,6 +2786,18 @@ radv_determine_ngg_settings(struct radv_pipeline *pipeline,
nir_function_impl *impl = nir_shader_get_entrypoint(nir[es_stage]);
infos[es_stage].has_ngg_early_prim_export = exec_list_is_singular(&impl->body);
/* Invocations that process an input vertex */
const struct gfx10_ngg_info *ngg_info = &infos[es_stage].ngg_info;
unsigned max_vtx_in = MIN2(256, ngg_info->enable_vertex_grouping ? ngg_info->hw_max_esverts : num_vertices_per_prim * ngg_info->max_gsprims);
unsigned lds_bytes_if_culling_off = 0;
/* We need LDS space when VS needs to export the primitive ID. */
if (es_stage == MESA_SHADER_VERTEX && infos[es_stage].vs.outinfo.export_prim_id)
lds_bytes_if_culling_off = max_vtx_in * 4u;
infos[es_stage].num_lds_blocks_when_not_culling =
DIV_ROUND_UP(lds_bytes_if_culling_off,
device->physical_device->rad_info.lds_encode_granularity);
}
}

View File

@@ -1015,7 +1015,6 @@ void radv_lower_ngg(struct radv_device *device, struct nir_shader *nir,
false,
pl_key->vs.instance_rate_inputs);
info->num_lds_blocks_when_not_culling = DIV_ROUND_UP(out_conf.lds_bytes_if_culling_off, device->physical_device->rad_info.lds_encode_granularity);
info->is_ngg_passthrough = out_conf.passthrough;
} else if (nir->info.stage == MESA_SHADER_GEOMETRY) {
assert(info->is_ngg);