diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 7b63f6b8cd3..c86ea3a5084 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -252,20 +252,12 @@ radv_rt_fill_group_info(struct radv_device *device, const struct radv_ray_tracin } static void -radv_rt_fill_stage_info(struct radv_device *device, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, - struct radv_ray_tracing_stage *stages, struct radv_pipeline_key *key) +radv_rt_fill_stage_info(const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, struct radv_ray_tracing_stage *stages) { - RADV_FROM_HANDLE(radv_pipeline_layout, pipeline_layout, pCreateInfo->layout); uint32_t idx; - for (idx = 0; idx < pCreateInfo->stageCount; idx++) { + for (idx = 0; idx < pCreateInfo->stageCount; idx++) stages[idx].stage = vk_to_mesa_shader_stage(pCreateInfo->pStages[idx].stage); - struct radv_shader_stage stage; - 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)); - } - if (pCreateInfo->pLibraryInfo) { for (unsigned i = 0; i < pCreateInfo->pLibraryInfo->libraryCount; ++i) { RADV_FROM_HANDLE(radv_pipeline, pipeline, pCreateInfo->pLibraryInfo->pLibraries[i]); @@ -281,6 +273,20 @@ radv_rt_fill_stage_info(struct radv_device *device, const VkRayTracingPipelineCr } } +static void +radv_init_rt_stage_hashes(struct radv_device *device, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, + struct radv_ray_tracing_stage *stages, const struct radv_pipeline_key *key) +{ + RADV_FROM_HANDLE(radv_pipeline_layout, pipeline_layout, pCreateInfo->layout); + + for (uint32_t idx = 0; idx < pCreateInfo->stageCount; idx++) { + struct radv_shader_stage stage; + 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)); + } +} + static VkRayTracingPipelineCreateInfoKHR radv_create_merged_rt_create_info(const VkRayTracingPipelineCreateInfoKHR *pCreateInfo) { @@ -656,6 +662,8 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra pipeline->stages = stages; pipeline->groups = groups; + radv_rt_fill_stage_info(pCreateInfo, stages); + struct radv_pipeline_key key = radv_generate_rt_pipeline_key(device, pipeline, pCreateInfo); /* cache robustness state for making merged shaders */ @@ -665,7 +673,7 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra if (key.stage_info[MESA_SHADER_INTERSECTION].uniform_robustness2) pipeline->traversal_uniform_robustness2 = true; - radv_rt_fill_stage_info(device, pCreateInfo, stages, &key); + radv_init_rt_stage_hashes(device, pCreateInfo, stages, &key); result = radv_rt_fill_group_info(device, pipeline, pCreateInfo, stages, capture_replay_blocks, pipeline->groups); if (result != VK_SUCCESS) goto fail;