radv: drop the module reference in radv_can_dump_shader_stats()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 6 Apr 2022 10:54:37 +0000 (12:54 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 8 Apr 2022 07:50:25 +0000 (09:50 +0200)
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>

src/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_shader.c
src/amd/vulkan/radv_shader.h

index ddfcbc3..f1761ea 100644 (file)
@@ -4539,11 +4539,11 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
    for (int i = 0; i < MESA_VULKAN_SHADER_STAGES; ++i) {
       free(binaries[i]);
       if (nir[i]) {
-         ralloc_free(nir[i]);
-
-         if (radv_can_dump_shader_stats(device, modules[i])) {
+         if (radv_can_dump_shader_stats(device, nir[i]) && pipeline->shaders[i]) {
             radv_dump_shader_stats(device, pipeline, i, stderr);
          }
+
+         ralloc_free(nir[i]);
       }
    }
 
index 95a82c7..6051163 100644 (file)
@@ -136,11 +136,10 @@ radv_can_dump_shader(struct radv_device *device, nir_shader *nir, bool meta_shad
 }
 
 bool
-radv_can_dump_shader_stats(struct radv_device *device, struct vk_shader_module *module)
+radv_can_dump_shader_stats(struct radv_device *device, nir_shader *nir)
 {
    /* Only dump non-meta shader stats. */
-   return device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS && module &&
-          !is_meta_shader(module->nir);
+   return device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS && !is_meta_shader(nir);
 }
 
 void
index 52b4cf9..d7f4668 100644 (file)
@@ -581,7 +581,7 @@ unsigned radv_compute_spi_ps_input(const struct radv_device *device,
 
 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);
+bool radv_can_dump_shader_stats(struct radv_device *device, nir_shader *nir);
 
 VkResult radv_dump_shader_stats(struct radv_device *device, struct radv_pipeline *pipeline,
                                 gl_shader_stage stage, FILE *output);