[Mesa-dev] [PATCH] radv: do not dump meta shaders with RADV_DEBUG=shaders

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Nov 30 21:51:57 UTC 2017


Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

On Thu, Nov 30, 2017 at 10:16 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> It's really annoying and this pollutes the output especially
> when a bunch of non-meta shaders are compiled.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_pipeline.c |  5 +----
>  src/amd/vulkan/radv_shader.c   |  2 +-
>  src/amd/vulkan/radv_shader.h   | 10 ++++++++++
>  3 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
> index faffca8330..fcbb5804f5 100644
> --- a/src/amd/vulkan/radv_pipeline.c
> +++ b/src/amd/vulkan/radv_pipeline.c
> @@ -1867,10 +1867,7 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
>         radv_link_shaders(pipeline, nir);
>
>         for (int i = 0; i < MESA_SHADER_STAGES; ++i) {
> -               if (!(device->instance->debug_flags & RADV_DEBUG_DUMP_SHADERS))
> -                       continue;
> -
> -               if (modules[i])
> +               if (modules[i] && radv_can_dump_shader(device, modules[i]))
>                         nir_print_shader(nir[i], stderr);
>         }
>
> diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
> index 32edf2abd2..5464d3a58e 100644
> --- a/src/amd/vulkan/radv_shader.c
> +++ b/src/amd/vulkan/radv_shader.c
> @@ -429,7 +429,7 @@ shader_variant_create(struct radv_device *device,
>                       unsigned *code_size_out)
>  {
>         enum radeon_family chip_family = device->physical_device->rad_info.family;
> -       bool dump_shaders = device->instance->debug_flags & RADV_DEBUG_DUMP_SHADERS;
> +       bool dump_shaders = radv_can_dump_shader(device, module);
>         enum ac_target_machine_options tm_options = 0;
>         struct radv_shader_variant *variant;
>         struct ac_shader_binary binary;
> diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
> index 9bdbe848c8..91f2e7f2a1 100644
> --- a/src/amd/vulkan/radv_shader.h
> +++ b/src/amd/vulkan/radv_shader.h
> @@ -28,6 +28,7 @@
>  #ifndef RADV_SHADER_H
>  #define RADV_SHADER_H
>
> +#include "radv_debug.h"
>  #include "radv_private.h"
>
>  #include "nir/nir.h"
> @@ -112,4 +113,13 @@ radv_shader_dump_stats(struct radv_device *device,
>                        gl_shader_stage stage,
>                        FILE *file);
>
> +static inline bool
> +radv_can_dump_shader(struct radv_device *device,
> +                    struct radv_shader_module *module)
> +{
> +       /* Only dump non-meta shaders, useful for debugging purposes. */
> +       return !module->nir &&
> +              device->instance->debug_flags & RADV_DEBUG_DUMP_SHADERS;
> +}
> +
>  #endif
> --
> 2.15.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list