radv: move ngg early prim export 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:41:49 +02:00
committed by Marge Bot
parent 24501b5452
commit 90858dd718
4 changed files with 7 additions and 4 deletions

View File

@@ -95,7 +95,6 @@ typedef struct
{ {
unsigned lds_bytes_if_culling_off; unsigned lds_bytes_if_culling_off;
bool passthrough; bool passthrough;
bool early_prim_export;
uint64_t nggc_inputs_read_by_pos; uint64_t nggc_inputs_read_by_pos;
uint64_t nggc_inputs_read_by_others; uint64_t nggc_inputs_read_by_others;
} ac_nir_ngg_config; } ac_nir_ngg_config;
@@ -107,6 +106,7 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
unsigned max_workgroup_size, unsigned max_workgroup_size,
unsigned wave_size, unsigned wave_size,
bool can_cull, bool can_cull,
bool early_prim_export,
bool consider_passthrough, bool consider_passthrough,
bool export_prim_id, bool export_prim_id,
bool provoking_vtx_last, bool provoking_vtx_last,

View File

@@ -1261,6 +1261,7 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
unsigned max_workgroup_size, unsigned max_workgroup_size,
unsigned wave_size, unsigned wave_size,
bool can_cull, bool can_cull,
bool early_prim_export,
bool consider_passthrough, bool consider_passthrough,
bool export_prim_id, bool export_prim_id,
bool provoking_vtx_last, bool provoking_vtx_last,
@@ -1282,7 +1283,7 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
lower_ngg_nogs_state state = { lower_ngg_nogs_state state = {
.passthrough = passthrough, .passthrough = passthrough,
.export_prim_id = export_prim_id, .export_prim_id = export_prim_id,
.early_prim_export = exec_list_is_singular(&impl->body), .early_prim_export = early_prim_export,
.use_edgeflags = use_edgeflags, .use_edgeflags = use_edgeflags,
.num_vertices_per_primitives = num_vertices_per_primitives, .num_vertices_per_primitives = num_vertices_per_primitives,
.provoking_vtx_idx = provoking_vtx_last ? (num_vertices_per_primitives - 1) : 0, .provoking_vtx_idx = provoking_vtx_last ? (num_vertices_per_primitives - 1) : 0,
@@ -1419,7 +1420,6 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
ac_nir_ngg_config ret = { ac_nir_ngg_config ret = {
.lds_bytes_if_culling_off = lds_bytes_if_culling_off, .lds_bytes_if_culling_off = lds_bytes_if_culling_off,
.passthrough = passthrough, .passthrough = passthrough,
.early_prim_export = state.early_prim_export,
.nggc_inputs_read_by_pos = state.inputs_needed_by_pos, .nggc_inputs_read_by_pos = state.inputs_needed_by_pos,
.nggc_inputs_read_by_others = state.inputs_needed_by_others, .nggc_inputs_read_by_others = state.inputs_needed_by_others,
}; };

View File

@@ -2783,6 +2783,9 @@ radv_determine_ngg_settings(struct radv_pipeline *pipeline,
infos[es_stage].has_ngg_culling = infos[es_stage].has_ngg_culling =
radv_consider_culling(device, nir[es_stage], ps_inputs_read, num_vertices_per_prim); radv_consider_culling(device, nir[es_stage], ps_inputs_read, num_vertices_per_prim);
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);
} }
} }

View File

@@ -1008,13 +1008,13 @@ void radv_lower_ngg(struct radv_device *device, struct nir_shader *nir,
info->workgroup_size, info->workgroup_size,
info->wave_size, info->wave_size,
info->has_ngg_culling, info->has_ngg_culling,
info->has_ngg_early_prim_export,
info->is_ngg_passthrough, info->is_ngg_passthrough,
export_prim_id, export_prim_id,
pl_key->vs.provoking_vtx_last, pl_key->vs.provoking_vtx_last,
false, false,
pl_key->vs.instance_rate_inputs); pl_key->vs.instance_rate_inputs);
info->has_ngg_early_prim_export = out_conf.early_prim_export;
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->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; info->is_ngg_passthrough = out_conf.passthrough;
} else if (nir->info.stage == MESA_SHADER_GEOMETRY) { } else if (nir->info.stage == MESA_SHADER_GEOMETRY) {