radv: add radv_shader_debug_info parameter to radv_shader_create

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40627>
This commit is contained in:
Rhys Perry 2026-03-23 13:17:20 +00:00 committed by Marge Bot
parent 98f96bd076
commit 41ffb087d2
6 changed files with 15 additions and 8 deletions

View file

@ -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;
}

View file

@ -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);

View file

@ -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;

View file

@ -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, &copy_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;

View file

@ -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);

View file

@ -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;