Module: Mesa
Branch: main
Commit: 0c76e088f2a8649baf7b1cafb179f70d8ccd892b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c76e088f2a8649baf7b1cafb179f70d8ccd892b

Author: Marcin Ĺšlusarz <[email protected]>
Date:   Tue Mar  7 10:41:10 2023 +0100

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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21787>

---

 src/intel/vulkan/anv_pipeline.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index ccaed387111..65fa682b368 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -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;
    }
 

Reply via email to