Mesa (main): radv: drop the module reference in radv_can_dump_shader()
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 8 09:56:43 UTC 2022
Module: Mesa
Branch: main
Commit: a4340974530fe52abb4b1d9a4932944a7fab0e77
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a4340974530fe52abb4b1d9a4932944a7fab0e77
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Wed Apr 6 12:23:40 2022 +0200
radv: drop the module reference in radv_can_dump_shader()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15766>
---
src/amd/vulkan/radv_pipeline.c | 6 ++++--
src/amd/vulkan/radv_shader.c | 14 +++++++-------
src/amd/vulkan/radv_shader.h | 3 +--
3 files changed, 12 insertions(+), 11 deletions(-)
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);
More information about the mesa-commit
mailing list