diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index cd7f017bfec..ddfcbc3ddeb 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -4410,8 +4410,10 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout } for (int i = 0; i < MESA_VULKAN_SHADER_STAGES; ++i) { - if (radv_can_dump_shader(device, modules[i], false)) - nir_print_shader(nir[i], stderr); + if (nir[i]) { + if (radv_can_dump_shader(device, nir[i], false)) + nir_print_shader(nir[i], stderr); + } } if (modules[MESA_SHADER_GEOMETRY] && !pipeline_has_ngg) { diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 17b410c45b8..95a82c72c1c 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -123,16 +123,16 @@ is_meta_shader(nir_shader *nir) } bool -radv_can_dump_shader(struct radv_device *device, struct vk_shader_module *module, - bool meta_shader) +radv_can_dump_shader(struct radv_device *device, nir_shader *nir, bool meta_shader) { if (!(device->instance->debug_flags & RADV_DEBUG_DUMP_SHADERS)) return false; - if (module) - return !is_meta_shader(module->nir) || - (device->instance->debug_flags & RADV_DEBUG_DUMP_META_SHADERS); - return meta_shader; + if ((is_meta_shader(nir) || meta_shader) && + !(device->instance->debug_flags & RADV_DEBUG_DUMP_META_SHADERS)) + return false; + + return true; } bool @@ -1956,7 +1956,7 @@ shader_compile(struct radv_device *device, struct vk_shader_module *module, options->family = chip_family; options->chip_class = device->physical_device->rad_info.chip_class; options->info = &device->physical_device->rad_info; - options->dump_shader = radv_can_dump_shader(device, module, gs_copy_shader || trap_handler_shader); + options->dump_shader = radv_can_dump_shader(device, shaders[0], gs_copy_shader || trap_handler_shader); options->dump_preoptir = options->dump_shader && device->instance->debug_flags & RADV_DEBUG_PREOPTIR; options->record_ir = keep_shader_info; diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index f1e16874ad3..52b4cf9343c 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -579,8 +579,7 @@ const char *radv_get_shader_name(const struct radv_shader_info *info, gl_shader_ unsigned radv_compute_spi_ps_input(const struct radv_device *device, const struct radv_shader_info *info); -bool radv_can_dump_shader(struct radv_device *device, struct vk_shader_module *module, - bool meta_shader); +bool radv_can_dump_shader(struct radv_device *device, nir_shader *nir, bool meta_shader); bool radv_can_dump_shader_stats(struct radv_device *device, struct vk_shader_module *module);