anv: call nir_shader_gather_info early

Shader info is needed for mesh in linking (in nir_lower_io_to_scalar_early,
see commit 5e144454) and will be needed once MR !17622 (anv: work around
for per-prim attributes corruption) lands.

We still need to call nir_shader_gather_info in anv_pipeline_lower_nir,
because the information got stale between anv_graphics_pipeline_load_nir
and anv_pipeline_lower_nir. Some examples:
- some FS inputs were marked as per-primitive during linking
  (brw_nir_link_shaders) affecting per_primitive_inputs mask
- some inputs and outputs were removed, because they are not used
  (nir_remove_unused_varyings) affecting outputs_written and inputs_read

This fixes func.mesh.ext.outputs.per_primitive.unused crucible test on DG2.
(I didn't know this test wasn't fixed by 5e144454, because I was testing
with !17622 merged-in, which added its own nir_shader_gather_info before
nir_lower_io_to_scalar_early).

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21787>
This commit is contained in:
Marcin Ślusarz 2023-03-07 10:41:10 +01:00 committed by Marge Bot
parent 6a16ed8d79
commit 0c76e088f2

View file

@ -1631,6 +1631,8 @@ anv_graphics_pipeline_load_nir(struct anv_graphics_pipeline *pipeline,
return vk_error(pipeline, VK_ERROR_UNKNOWN);
}
nir_shader_gather_info(stages[s].nir, nir_shader_get_entrypoint(stages[s].nir));
stages[s].feedback.duration += os_time_get_nano() - stage_start;
}