Mesa (main): radv: Fix RTPSO hashing of pGroups.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 20 06:22:43 UTC 2022


Module: Mesa
Branch: main
Commit: 04459c82874b648a9c3ed4c9384b831772bb07e6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=04459c82874b648a9c3ed4c9384b831772bb07e6

Author: Hans-Kristian Arntzen <post at arntzen-software.no>
Date:   Wed May 18 15:44:30 2022 +0200

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 <post at arntzen-software.no>
Reviewed-by: Georg Lehmann <dadschoorse at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16582>

---

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



More information about the mesa-commit mailing list