radv: include RT shaders in RADV_DEBUG=shaders,shaderstats
authorRhys Perry <pendingchaos02@gmail.com>
Mon, 6 Dec 2021 18:21:11 +0000 (18:21 +0000)
committerMarge Bot <emma+marge@anholt.net>
Wed, 8 Dec 2021 11:07:40 +0000 (11:07 +0000)
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@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14087>

src/amd/vulkan/radv_meta.c
src/amd/vulkan/radv_shader.c

index e120c37..af4652b 100644 (file)
@@ -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;
 }
 
index 368586b..00731ea 100644 (file)
@@ -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;