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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23747>
This commit is contained in:
Konstantin Seurer 2023-06-20 16:52:50 +02:00 committed by Marge Bot
parent de1092e256
commit 1e2f647fbb

View file

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