radv: drop the module reference in radv_can_dump_shader()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15766>
This commit is contained in:
Samuel Pitoiset
2022-04-06 12:23:40 +02:00
parent e11712a0a3
commit a434097453
3 changed files with 12 additions and 11 deletions

View File

@@ -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) { for (int i = 0; i < MESA_VULKAN_SHADER_STAGES; ++i) {
if (radv_can_dump_shader(device, modules[i], false)) if (nir[i]) {
nir_print_shader(nir[i], stderr); if (radv_can_dump_shader(device, nir[i], false))
nir_print_shader(nir[i], stderr);
}
} }
if (modules[MESA_SHADER_GEOMETRY] && !pipeline_has_ngg) { if (modules[MESA_SHADER_GEOMETRY] && !pipeline_has_ngg) {

View File

@@ -123,16 +123,16 @@ is_meta_shader(nir_shader *nir)
} }
bool bool
radv_can_dump_shader(struct radv_device *device, struct vk_shader_module *module, radv_can_dump_shader(struct radv_device *device, nir_shader *nir, bool meta_shader)
bool meta_shader)
{ {
if (!(device->instance->debug_flags & RADV_DEBUG_DUMP_SHADERS)) if (!(device->instance->debug_flags & RADV_DEBUG_DUMP_SHADERS))
return false; 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 bool
@@ -1956,7 +1956,7 @@ shader_compile(struct radv_device *device, struct vk_shader_module *module,
options->family = chip_family; options->family = chip_family;
options->chip_class = device->physical_device->rad_info.chip_class; options->chip_class = device->physical_device->rad_info.chip_class;
options->info = &device->physical_device->rad_info; 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_preoptir =
options->dump_shader && device->instance->debug_flags & RADV_DEBUG_PREOPTIR; options->dump_shader && device->instance->debug_flags & RADV_DEBUG_PREOPTIR;
options->record_ir = keep_shader_info; options->record_ir = keep_shader_info;

View File

@@ -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, unsigned radv_compute_spi_ps_input(const struct radv_device *device,
const struct radv_shader_info *info); const struct radv_shader_info *info);
bool radv_can_dump_shader(struct radv_device *device, struct vk_shader_module *module, bool radv_can_dump_shader(struct radv_device *device, nir_shader *nir, bool meta_shader);
bool meta_shader);
bool radv_can_dump_shader_stats(struct radv_device *device, struct vk_shader_module *module); bool radv_can_dump_shader_stats(struct radv_device *device, struct vk_shader_module *module);