diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index a4e3e2fa2c8..0e145be6d1d 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -252,7 +252,8 @@ radv_get_hash_flags(const struct radv_device *device, bool stats) } void -radv_shader_stage_init(const VkPipelineShaderStageCreateInfo *sinfo, struct radv_shader_stage *out_stage) +radv_pipeline_stage_init(const VkPipelineShaderStageCreateInfo *sinfo, + const struct radv_pipeline_layout *pipeline_layout, struct radv_shader_stage *out_stage) { const VkShaderModuleCreateInfo *minfo = vk_find_struct_const(sinfo->pNext, SHADER_MODULE_CREATE_INFO); const VkPipelineShaderStageModuleIdentifierCreateInfoEXT *iinfo = @@ -282,6 +283,8 @@ radv_shader_stage_init(const VkPipelineShaderStageCreateInfo *sinfo, struct radv out_stage->spirv.size = minfo->codeSize; } + radv_shader_layout_init(pipeline_layout, out_stage->stage, &out_stage->layout); + vk_pipeline_hash_shader_stage(sinfo, NULL, out_stage->shader_sha1); } diff --git a/src/amd/vulkan/radv_pipeline_compute.c b/src/amd/vulkan/radv_pipeline_compute.c index 3b70e10f6cf..e44ccaa221f 100644 --- a/src/amd/vulkan/radv_pipeline_compute.c +++ b/src/amd/vulkan/radv_pipeline_compute.c @@ -196,8 +196,7 @@ radv_compute_pipeline_compile(struct radv_compute_pipeline *pipeline, struct rad int64_t pipeline_start = os_time_get_nano(); - radv_shader_stage_init(pStage, &cs_stage); - radv_shader_layout_init(pipeline_layout, MESA_SHADER_COMPUTE, &cs_stage.layout); + radv_pipeline_stage_init(pStage, pipeline_layout, &cs_stage); radv_hash_shaders(hash, &cs_stage, 1, pipeline_layout, pipeline_key, radv_get_hash_flags(device, keep_statistic_info)); diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index 93aa301e5c8..585fc74d810 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -2337,8 +2337,7 @@ radv_pipeline_import_retained_shaders(const struct radv_device *device, struct r if (!(shader_stage_to_pipeline_library_flags(sinfo->stage) & lib->lib_flags)) continue; - radv_shader_stage_init(sinfo, &stages[s]); - radv_shader_layout_init(&lib->layout, s, &stages[s].layout); + radv_pipeline_stage_init(sinfo, &lib->layout, &stages[s]); } /* Import the NIR shaders (after SPIRV->NIR). */ @@ -2663,8 +2662,7 @@ radv_graphics_pipeline_compile(struct radv_graphics_pipeline *pipeline, const Vk if (!(shader_stage_to_pipeline_library_flags(sinfo->stage) & lib_flags)) continue; - radv_shader_stage_init(sinfo, &stages[stage]); - radv_shader_layout_init(pipeline_layout, stage, &stages[stage].layout); + radv_pipeline_stage_init(sinfo, pipeline_layout, &stages[stage]); } radv_pipeline_load_retained_shaders(device, pipeline, pCreateInfo, stages); diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 60824fc27bc..e03e87a4cc2 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -260,8 +260,7 @@ radv_rt_fill_stage_info(struct radv_device *device, const VkRayTracingPipelineCr stages[idx].stage = vk_to_mesa_shader_stage(pCreateInfo->pStages[idx].stage); struct radv_shader_stage stage; - radv_shader_stage_init(&pCreateInfo->pStages[idx], &stage); - radv_shader_layout_init(pipeline_layout, stages[idx].stage, &stage.layout); + radv_pipeline_stage_init(&pCreateInfo->pStages[idx], pipeline_layout, &stage); radv_hash_shaders(stages[idx].sha1, &stage, 1, NULL, key, radv_get_hash_flags(device, false)); } @@ -453,8 +452,7 @@ radv_rt_compile_shaders(struct radv_device *device, struct vk_pipeline_cache *ca for (uint32_t idx = 0; idx < pCreateInfo->stageCount; idx++) { int64_t stage_start = os_time_get_nano(); struct radv_shader_stage stage; - radv_shader_stage_init(&pCreateInfo->pStages[idx], &stage); - radv_shader_layout_init(pipeline_layout, stages[idx].stage, &stage.layout); + radv_pipeline_stage_init(&pCreateInfo->pStages[idx], pipeline_layout, &stage); if (stages[idx].shader) goto feedback; diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index d63e3a53f10..1ea606c2ca1 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -2171,7 +2171,8 @@ struct radv_event { struct radv_pipeline_key; struct radv_ray_tracing_group; -void radv_shader_stage_init(const VkPipelineShaderStageCreateInfo *sinfo, struct radv_shader_stage *out_stage); +void radv_pipeline_stage_init(const VkPipelineShaderStageCreateInfo *sinfo, const struct radv_pipeline_layout *layout, + struct radv_shader_stage *out_stage); void radv_hash_shaders(unsigned char *hash, const struct radv_shader_stage *stages, uint32_t stage_count, const struct radv_pipeline_layout *layout, const struct radv_pipeline_key *key, uint32_t flags); diff --git a/src/amd/vulkan/radv_rt_shader.c b/src/amd/vulkan/radv_rt_shader.c index 32228319fd4..0a87098140f 100644 --- a/src/amd/vulkan/radv_rt_shader.c +++ b/src/amd/vulkan/radv_rt_shader.c @@ -815,8 +815,7 @@ radv_parse_rt_stage(struct radv_device *device, const VkPipelineShaderStageCreat { struct radv_shader_stage rt_stage; - radv_shader_stage_init(sinfo, &rt_stage); - radv_shader_layout_init(pipeline_layout, vk_to_mesa_shader_stage(sinfo->stage), &rt_stage.layout); + radv_pipeline_stage_init(sinfo, pipeline_layout, &rt_stage); nir_shader *shader = radv_shader_spirv_to_nir(device, &rt_stage, key, false);