On 12/04/2017 11:31 AM, James Legg wrote:
Hi Samuel,

On Thu, 2017-11-30 at 22:16 +0100, Samuel Pitoiset wrote:
It's really annoying and this pollutes the output especially
when a bunch of non-meta shaders are compiled.

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;

This shader_variant_create function is called with NULL for the module
parameter in radv_create_gs_copy_shader.

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
@@ -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

Consequently, there is a NULL dereference here if
radv_create_gs_copy_shader is used.

Yeah, I figured and there is a patch on the list for that.
Thanks James!


James

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to