radv: do not dump meta shaders with RADV_DEBUG=shaders
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 30 Nov 2017 21:16:09 +0000 (22:16 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 1 Dec 2017 10:38:26 +0000 (11:38 +0100)
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@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_shader.c
src/amd/vulkan/radv_shader.h

index faffca83308063b240a766482c7738e8988aa885..fcbb5804f5e9df5a16b7153e2f4b65371755ee79 100644 (file)
@@ -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);
        }
 
index 32edf2abd222b0bf297aed9a11efabba99099509..5464d3a58e930682771b1476f3996dfea2c5973f 100644 (file)
@@ -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;
index 9bdbe848c8fd86de0dffccd553394f5715d71a80..91f2e7f2a1201ab92622c35bb7be7cc508d8ae0a 100644 (file)
@@ -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