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

Author: Marek Olšák <[email protected]>
Date:   Thu Jul 21 09:48:29 2022 -0400

radeonsi,radv: run ac_nir_lower_resinfo

Emulating image_get_resinfo should be faster than using the hw.

Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17693>

---

 src/amd/vulkan/radv_pipeline.c           | 4 ++++
 src/gallium/drivers/radeonsi/si_shader.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 5be524e3bac..3847f983eb0 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -4865,6 +4865,10 @@ radv_create_shaders(struct radv_pipeline *pipeline, 
struct radv_pipeline_layout
          if (lowered_ngg)
             radv_lower_ngg(device, &stages[i], pipeline_key);
 
+         if (radv_use_llvm_for_stage(device, i) &&
+             stages[i].nir->info.uses_resource_info_query)
+            NIR_PASS(_, stages[i].nir, ac_nir_lower_resinfo, 
device->physical_device->rad_info.gfx_level);
+
          NIR_PASS(_, stages[i].nir, ac_nir_lower_global_access);
          NIR_PASS_V(stages[i].nir, radv_nir_lower_abi, 
device->physical_device->rad_info.gfx_level,
                     &stages[i].info, &stages[i].args, pipeline_key,
diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 63cafa8ef04..15d779335a3 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1607,6 +1607,9 @@ struct nir_shader *si_get_nir_shader(struct si_shader 
*shader, bool *free_nir,
    if (sel->stage <= MESA_SHADER_GEOMETRY)
       NIR_PASS(progress, nir, si_nir_kill_outputs, key);
 
+   if (nir->info.uses_resource_info_query)
+      NIR_PASS(progress, nir, ac_nir_lower_resinfo, 
sel->screen->info.gfx_level);
+
    bool inline_uniforms = false;
    uint32_t *inlined_uniform_values;
    si_get_inline_uniform_state((union si_shader_key*)key, 
sel->pipe_shader_type,

Reply via email to