Mesa (main): radv: include RT shaders in RADV_DEBUG=shaders,shaderstats

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 8 11:31:07 UTC 2021


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Mon Dec  6 18:21:11 2021 +0000

radv: include RT shaders in RADV_DEBUG=shaders,shaderstats

Instead of using module->nir or nir->info->name to determine if it's a
meta shader, use nir->info->internal.

This also has an effect of disabling printing of meta shaders with
NIR_DEBUG=print.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14087>

---

 src/amd/vulkan/radv_meta.c   |  2 ++
 src/amd/vulkan/radv_shader.c | 16 ++++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
index e120c37f19c..af4652b30f4 100644
--- a/src/amd/vulkan/radv_meta.c
+++ b/src/amd/vulkan/radv_meta.c
@@ -564,6 +564,8 @@ nir_builder PRINTFLIKE(2, 3) radv_meta_init_shader(gl_shader_stage stage, const
       va_end(args);
    }
 
+   b.shader->info.internal = true;
+
    return b;
 }
 
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 368586b466a..00731ea074f 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -103,6 +103,12 @@ radv_get_nir_options(struct radv_physical_device *device)
    };
 }
 
+static bool
+is_meta_shader(nir_shader *nir)
+{
+   return nir && nir->info.internal;
+}
+
 bool
 radv_can_dump_shader(struct radv_device *device, struct vk_shader_module *module,
                      bool meta_shader)
@@ -110,7 +116,8 @@ radv_can_dump_shader(struct radv_device *device, struct vk_shader_module *module
    if (!(device->instance->debug_flags & RADV_DEBUG_DUMP_SHADERS))
       return false;
    if (module)
-      return !module->nir || (device->instance->debug_flags & RADV_DEBUG_DUMP_META_SHADERS);
+      return !is_meta_shader(module->nir) ||
+             (device->instance->debug_flags & RADV_DEBUG_DUMP_META_SHADERS);
 
    return meta_shader;
 }
@@ -119,7 +126,8 @@ bool
 radv_can_dump_shader_stats(struct radv_device *device, struct vk_shader_module *module)
 {
    /* Only dump non-meta shader stats. */
-   return device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS && module && !module->nir;
+   return device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS && module &&
+          !is_meta_shader(module->nir);
 }
 
 void
@@ -898,7 +906,7 @@ radv_consider_culling(struct radv_device *device, struct nir_shader *nir, uint64
                       unsigned num_vertices_per_primitive, const struct radv_shader_info *info)
 {
    /* Culling doesn't make sense for meta shaders. */
-   if (!!nir->info.name)
+   if (is_meta_shader(nir))
       return false;
 
    /* We don't support culling with multiple viewports yet. */
@@ -1787,7 +1795,7 @@ shader_compile(struct radv_device *device, struct vk_shader_module *module,
    options->address32_hi = device->physical_device->rad_info.address32_hi;
    options->has_ls_vgpr_init_bug = device->physical_device->rad_info.has_ls_vgpr_init_bug;
    options->enable_mrt_output_nan_fixup =
-      module && !module->nir && options->key.ps.enable_mrt_output_nan_fixup;
+      module && !is_meta_shader(module->nir) && options->key.ps.enable_mrt_output_nan_fixup;
    options->adjust_frag_coord_z = device->adjust_frag_coord_z;
    options->has_image_load_dcc_bug = device->physical_device->rad_info.has_image_load_dcc_bug;
    options->debug.func = radv_compiler_debug;



More information about the mesa-commit mailing list