From 04459c82874b648a9c3ed4c9384b831772bb07e6 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Wed, 18 May 2022 15:44:30 +0200 Subject: [PATCH] radv: Fix RTPSO hashing of pGroups. There are padding bytes here. Only hash relevant members. Fixes: ca2d96db51e ("radv: Add caching for RT pipelines.") Signed-off-by: Hans-Kristian Arntzen Reviewed-by: Georg Lehmann Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_pipeline_cache.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c index cce39e5a66d..fb7f33934b9 100644 --- a/src/amd/vulkan/radv_pipeline_cache.c +++ b/src/amd/vulkan/radv_pipeline_cache.c @@ -164,8 +164,18 @@ radv_hash_rt_shaders(unsigned char *hash, const VkRayTracingPipelineCreateInfoKH } } - _mesa_sha1_update(&ctx, pCreateInfo->pGroups, - pCreateInfo->groupCount * sizeof(*pCreateInfo->pGroups)); + for (uint32_t i = 0; i < pCreateInfo->groupCount; i++) { + _mesa_sha1_update(&ctx, &pCreateInfo->pGroups[i].type, + sizeof(pCreateInfo->pGroups[i].type)); + _mesa_sha1_update(&ctx, &pCreateInfo->pGroups[i].generalShader, + sizeof(pCreateInfo->pGroups[i].generalShader)); + _mesa_sha1_update(&ctx, &pCreateInfo->pGroups[i].anyHitShader, + sizeof(pCreateInfo->pGroups[i].anyHitShader)); + _mesa_sha1_update(&ctx, &pCreateInfo->pGroups[i].closestHitShader, + sizeof(pCreateInfo->pGroups[i].closestHitShader)); + _mesa_sha1_update(&ctx, &pCreateInfo->pGroups[i].intersectionShader, + sizeof(pCreateInfo->pGroups[i].intersectionShader)); + } if (!radv_rt_pipeline_has_dynamic_stack_size(pCreateInfo)) _mesa_sha1_update(&ctx, &pCreateInfo->maxPipelineRayRecursionDepth, 4);