diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c index 99f33064377..c3fa4084c79 100644 --- a/src/amd/vulkan/radv_pipeline_cache.c +++ b/src/amd/vulkan/radv_pipeline_cache.c @@ -162,11 +162,16 @@ radv_is_cache_disabled(const struct radv_device *device, const struct vk_pipelin struct radv_shader * radv_shader_create(struct radv_device *device, struct vk_pipeline_cache *cache, const struct radv_shader_binary *binary, - bool skip_cache) + bool skip_cache, struct radv_shader_debug_info *dbg) { - if (radv_is_cache_disabled(device, cache) || skip_cache) { + if (radv_is_cache_disabled(device, cache) || skip_cache || (dbg && dbg->dump_shader)) { struct radv_shader *shader; radv_shader_create_uncached(device, binary, false, NULL, &shader); + if (dbg) { + struct amd_stats *stats = shader->dbg.statistics; + shader->dbg = *dbg; + shader->dbg.statistics = stats; + } return shader; } diff --git a/src/amd/vulkan/radv_pipeline_cache.h b/src/amd/vulkan/radv_pipeline_cache.h index d0b0f5c4151..2bebd157fee 100644 --- a/src/amd/vulkan/radv_pipeline_cache.h +++ b/src/amd/vulkan/radv_pipeline_cache.h @@ -24,6 +24,7 @@ struct radv_graphics_pipeline; struct radv_compute_pipeline; struct radv_ray_tracing_stage; struct radv_shader_binary; +struct radv_shader_debug_info; struct radv_shader_stage; struct radv_spirv_to_nir_options; struct util_dynarray; @@ -34,7 +35,8 @@ void radv_hash_graphics_spirv_to_nir(blake3_hash hash, const struct radv_shader_ const struct radv_spirv_to_nir_options *options); struct radv_shader *radv_shader_create(struct radv_device *device, struct vk_pipeline_cache *cache, - const struct radv_shader_binary *binary, bool skip_cache); + const struct radv_shader_binary *binary, bool skip_cache, + struct radv_shader_debug_info *dbg); bool radv_graphics_pipeline_cache_search(struct radv_device *device, struct vk_pipeline_cache *cache, struct radv_graphics_pipeline *pipeline, bool *found_in_application_cache); diff --git a/src/amd/vulkan/radv_pipeline_compute.c b/src/amd/vulkan/radv_pipeline_compute.c index 0d704504ef1..0db1542f9ec 100644 --- a/src/amd/vulkan/radv_pipeline_compute.c +++ b/src/amd/vulkan/radv_pipeline_compute.c @@ -136,7 +136,7 @@ radv_compile_cs(struct radv_device *device, struct vk_pipeline_cache *cache, str if (keep_executable_info || dump_shader) nir_string = radv_dump_nir_shaders(instance, &cs_stage->nir, 1); - cs_shader = radv_shader_create(device, cache, *cs_binary, skip_shaders_cache || dump_shader); + cs_shader = radv_shader_create(device, cache, *cs_binary, skip_shaders_cache || dump_shader, NULL); radv_parse_binary_debug_info(device, *cs_binary, &cs_shader->dbg); cs_shader->dbg.nir_string = nir_string; diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index d79e3ac8283..22c52c4fb9a 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -2424,7 +2424,7 @@ radv_create_gs_copy_shader(struct radv_device *device, struct vk_pipeline_cache nir_string = radv_dump_nir_shaders(instance, &nir, 1); struct radv_shader *copy_shader = - radv_shader_create(device, cache, *gs_copy_binary, skip_shaders_cache || dump_shader); + radv_shader_create(device, cache, *gs_copy_binary, skip_shaders_cache || dump_shader, NULL); if (copy_shader) { radv_parse_binary_debug_info(device, *gs_copy_binary, ©_shader->dbg); @@ -2501,7 +2501,7 @@ radv_graphics_shaders_nir_to_asm(struct radv_device *device, struct vk_pipeline_ if (keep_executable_info || dump_shader) nir_string = radv_dump_nir_shaders(instance, nir_shaders, shader_count); - shaders[s] = radv_shader_create(device, cache, binaries[s], skip_shaders_cache || dump_shader); + shaders[s] = radv_shader_create(device, cache, binaries[s], skip_shaders_cache || dump_shader, NULL); radv_parse_binary_debug_info(device, binaries[s], &shaders[s]->dbg); shaders[s]->dbg.nir_string = nir_string; diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index f0b0a08fd34..fb98e33237d 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -523,7 +523,7 @@ radv_rt_nir_to_asm(struct radv_device *device, struct vk_pipeline_cache *cache, return result; } } else - shader = radv_shader_create(device, cache, binary, skip_shaders_cache || dump_shader); + shader = radv_shader_create(device, cache, binary, skip_shaders_cache || dump_shader, NULL); if (shader) { radv_parse_binary_debug_info(device, binary, &shader->dbg); diff --git a/src/amd/vulkan/radv_shader_object.c b/src/amd/vulkan/radv_shader_object.c index 06583538de5..529cc073676 100644 --- a/src/amd/vulkan/radv_shader_object.c +++ b/src/amd/vulkan/radv_shader_object.c @@ -259,7 +259,7 @@ radv_shader_object_init_binary(struct radv_device *device, struct blob_reader *b if (memcmp(blake3, binary_blake3, BLAKE3_KEY_LEN)) return VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT; - *shader_out = radv_shader_create(device, NULL, binary, true); + *shader_out = radv_shader_create(device, NULL, binary, true, NULL); *binary_out = (struct radv_shader_binary *)binary; return VK_SUCCESS;