radv: move ngg passthrough 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:56:44 +02:00 committed by Marge Bot
parent 2ce78a30ff
commit 52e91f7640
4 changed files with 8 additions and 9 deletions

View file

@ -93,7 +93,6 @@ ac_nir_lower_indirect_derefs(nir_shader *shader,
typedef struct
{
bool passthrough;
uint64_t nggc_inputs_read_by_pos;
uint64_t nggc_inputs_read_by_others;
} ac_nir_ngg_config;
@ -106,7 +105,7 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
unsigned wave_size,
bool can_cull,
bool early_prim_export,
bool consider_passthrough,
bool passthrough,
bool export_prim_id,
bool provoking_vtx_last,
bool use_edgeflags,

View file

@ -1262,7 +1262,7 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
unsigned wave_size,
bool can_cull,
bool early_prim_export,
bool consider_passthrough,
bool passthrough,
bool export_prim_id,
bool provoking_vtx_last,
bool use_edgeflags,
@ -1271,9 +1271,7 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
assert(impl);
assert(max_num_es_vertices && max_workgroup_size && wave_size);
bool passthrough = consider_passthrough && !can_cull &&
!(shader->info.stage == MESA_SHADER_VERTEX && export_prim_id);
assert(!(can_cull && passthrough));
nir_variable *position_value_var = nir_local_variable_create(impl, glsl_vec4_type(), "position_value");
nir_variable *prim_exp_arg_var = nir_local_variable_create(impl, glsl_uint_type(), "prim_exp_arg");
@ -1415,7 +1413,6 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
shader->info.shared_size = state.total_lds_bytes;
ac_nir_ngg_config ret = {
.passthrough = passthrough,
.nggc_inputs_read_by_pos = state.inputs_needed_by_pos,
.nggc_inputs_read_by_others = state.inputs_needed_by_others,
};

View file

@ -2798,6 +2798,11 @@ radv_determine_ngg_settings(struct radv_pipeline *pipeline,
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);
infos[es_stage].is_ngg_passthrough = infos[es_stage].is_ngg_passthrough &&
!infos[es_stage].has_ngg_culling &&
!(es_stage == MESA_SHADER_VERTEX &&
infos[es_stage].vs.outinfo.export_prim_id);
}
}

View file

@ -1014,8 +1014,6 @@ void radv_lower_ngg(struct radv_device *device, struct nir_shader *nir,
pl_key->vs.provoking_vtx_last,
false,
pl_key->vs.instance_rate_inputs);
info->is_ngg_passthrough = out_conf.passthrough;
} else if (nir->info.stage == MESA_SHADER_GEOMETRY) {
assert(info->is_ngg);
ac_nir_lower_ngg_gs(