From 48db5c037825ed87e942229f8b636a99f00cc507 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 17 Apr 2026 15:57:00 +0200 Subject: [PATCH] radv: pass radv_compiler_info to radv_pipeline_get_shader_key() Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_device.c | 1 + src/amd/vulkan/radv_pipeline.c | 8 ++++---- src/amd/vulkan/radv_pipeline.h | 2 +- src/amd/vulkan/radv_pipeline_compute.c | 4 ++-- src/amd/vulkan/radv_pipeline_graphics.c | 2 +- src/amd/vulkan/radv_pipeline_rt.c | 2 +- src/amd/vulkan/radv_shader.h | 1 + 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index dc06a6b3c50..e1fe3bd537a 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1190,6 +1190,7 @@ radv_device_init_compiler_info(struct radv_device *device) .buffer_descriptor_size = pdev->vk.properties.bufferDescriptorSize, .buffer_descriptor_alignment = pdev->vk.properties.bufferDescriptorAlignment, /* Shader features */ + .device_robustness_state = &device->vk.robustness_state, .use_ngg = pdev->use_ngg, .use_ngg_streamout = pdev->use_ngg_streamout, .load_grid_size_from_user_sgpr = device->load_grid_size_from_user_sgpr, diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index a9489403561..f4fafac647a 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -107,10 +107,10 @@ radv_DestroyPipeline(VkDevice _device, VkPipeline _pipeline, const VkAllocationC } struct radv_shader_stage_key -radv_pipeline_get_shader_key(const struct radv_device *device, const VkPipelineShaderStageCreateInfo *stage, - VkPipelineCreateFlags2 flags, const void *pNext) +radv_pipeline_get_shader_key(const struct radv_compiler_info *compiler_info, + const VkPipelineShaderStageCreateInfo *stage, VkPipelineCreateFlags2 flags, + const void *pNext) { - const struct radv_compiler_info *compiler_info = &device->compiler_info; mesa_shader_stage s = vk_to_mesa_shader_stage(stage->stage); struct vk_pipeline_robustness_state rs; struct radv_shader_stage_key key = {0}; @@ -139,7 +139,7 @@ radv_pipeline_get_shader_key(const struct radv_device *device, const VkPipelineS key.version = compiler_info->override_compute_shader_version; } - vk_pipeline_robustness_state_fill(&device->vk.robustness_state, &rs, pNext, stage->pNext); + vk_pipeline_robustness_state_fill(compiler_info->device_robustness_state, &rs, pNext, stage->pNext); radv_set_stage_key_robustness(&rs, s, &key); diff --git a/src/amd/vulkan/radv_pipeline.h b/src/amd/vulkan/radv_pipeline.h index 9fccf79a8a0..1694650341f 100644 --- a/src/amd/vulkan/radv_pipeline.h +++ b/src/amd/vulkan/radv_pipeline.h @@ -82,7 +82,7 @@ void radv_pipeline_init(struct radv_device *device, struct radv_pipeline *pipeli void radv_pipeline_destroy(struct radv_device *device, struct radv_pipeline *pipeline, const VkAllocationCallbacks *allocator); -struct radv_shader_stage_key radv_pipeline_get_shader_key(const struct radv_device *device, +struct radv_shader_stage_key radv_pipeline_get_shader_key(const struct radv_compiler_info *compiler_info, const VkPipelineShaderStageCreateInfo *stage, VkPipelineCreateFlags2 flags, const void *pNext); diff --git a/src/amd/vulkan/radv_pipeline_compute.c b/src/amd/vulkan/radv_pipeline_compute.c index 59d2ea3fe8d..334f54f214d 100644 --- a/src/amd/vulkan/radv_pipeline_compute.c +++ b/src/amd/vulkan/radv_pipeline_compute.c @@ -163,7 +163,7 @@ radv_compute_pipeline_hash(const struct radv_device *device, const VkComputePipe blake3_hasher ctx; struct radv_shader_stage_key stage_key = - radv_pipeline_get_shader_key(device, sinfo, create_flags, pCreateInfo->pNext); + radv_pipeline_get_shader_key(&device->compiler_info, sinfo, create_flags, pCreateInfo->pNext); _mesa_blake3_init(&ctx); radv_pipeline_hash(device, pipeline_layout, &ctx); @@ -208,7 +208,7 @@ radv_compute_pipeline_compile(const VkComputePipelineCreateInfo *pCreateInfo, st int64_t stage_start = os_time_get_nano(); const struct radv_shader_stage_key stage_key = - radv_pipeline_get_shader_key(device, &pCreateInfo->stage, pipeline->base.create_flags, pCreateInfo->pNext); + radv_pipeline_get_shader_key(compiler_info, &pCreateInfo->stage, pipeline->base.create_flags, pCreateInfo->pNext); radv_pipeline_stage_init(pipeline->base.create_flags, pStage, pipeline_layout, &stage_key, &cs_stage); diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index b7d80ede12f..060e221e516 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -1803,7 +1803,7 @@ radv_generate_graphics_pipeline_key(const struct radv_device *device, const VkGr const VkPipelineShaderStageCreateInfo *stage = &pCreateInfo->pStages[i]; mesa_shader_stage s = vk_to_mesa_shader_stage(stage->stage); - key.stage_info[s] = radv_pipeline_get_shader_key(device, stage, create_flags, pCreateInfo->pNext); + key.stage_info[s] = radv_pipeline_get_shader_key(compiler_info, stage, create_flags, pCreateInfo->pNext); if (s == MESA_SHADER_MESH && (state->shader_stages & VK_SHADER_STAGE_TASK_BIT_EXT)) key.stage_info[s].has_task_shader = true; diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index d58c05373ce..4214d39c917 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -84,7 +84,7 @@ radv_generate_rt_shaders_key(const struct radv_device *device, const VkRayTracin const VkPipelineShaderStageCreateInfo *stage = &pCreateInfo->pStages[i]; mesa_shader_stage s = vk_to_mesa_shader_stage(stage->stage); - stage_keys[s] = radv_pipeline_get_shader_key(device, stage, create_flags, pCreateInfo->pNext); + stage_keys[s] = radv_pipeline_get_shader_key(&device->compiler_info, stage, create_flags, pCreateInfo->pNext); } if (pCreateInfo->pLibraryInfo) { diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 353c6b9469e..50993143643 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -560,6 +560,7 @@ struct radv_compiler_info { uint8_t override_ray_tracing_shader_version; /* Shader features */ + const struct vk_pipeline_robustness_state *device_robustness_state; uint8_t sampled_image_desc_size; uint8_t combined_image_sampler_desc_size; uint8_t combined_image_sampler_offset;