From 1e2f647fbbace978228029f9dcc262eb3608ae50 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Tue, 20 Jun 2023 16:52:50 +0200 Subject: [PATCH] radv/rt: Hash stages using radv_hash_shaders The hash also depends on the radv_pipeline_key as well as the flags. The pipeline layout will also play a role when we implement inline descriptor sets and push constants. Part-of: --- src/amd/vulkan/radv_pipeline_rt.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 46c225d..1b7b5b3 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -183,16 +183,17 @@ radv_rt_fill_group_info(struct radv_device *device, const VkRayTracingPipelineCr } static void -radv_rt_fill_stage_info(const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, struct radv_ray_tracing_stage *stages) +radv_rt_fill_stage_info(struct radv_device *device, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, + struct radv_ray_tracing_stage *stages, const struct radv_pipeline_key *key) { uint32_t idx; for (idx = 0; idx < pCreateInfo->stageCount; idx++) { stages[idx].stage = vk_to_mesa_shader_stage(pCreateInfo->pStages[idx].stage); - struct mesa_sha1 ctx; - _mesa_sha1_init(&ctx); - radv_hash_rt_stages(&ctx, pCreateInfo->pStages + idx, 1); - _mesa_sha1_final(&ctx, stages[idx].sha1); + struct radv_pipeline_stage stage; + radv_pipeline_stage_init(&pCreateInfo->pStages[idx], &stage, stages[idx].stage); + + radv_hash_shaders(stages[idx].sha1, &stage, 1, NULL, key, radv_get_hash_flags(device, false)); } if (pCreateInfo->pLibraryInfo) { @@ -548,13 +549,13 @@ 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_pipeline_key(device, &pipeline->base.base, pCreateInfo->flags); + + radv_rt_fill_stage_info(device, pCreateInfo, stages, &key); result = radv_rt_fill_group_info(device, pCreateInfo, stages, pipeline->groups); if (result != VK_SUCCESS) goto fail; - struct radv_pipeline_key key = radv_generate_pipeline_key(device, &pipeline->base.base, pCreateInfo->flags); - radv_hash_rt_shaders(pipeline->sha1, pCreateInfo, &key, pipeline->groups, radv_get_hash_flags(device, keep_statistic_info)); pipeline->base.base.pipeline_hash = *(uint64_t *)pipeline->sha1; -- 2.7.4