Mesa (staging/22.1): radv: Fix RTPSO hashing of pGroups.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 23 18:09:44 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: 1f8e71397b0e78c66a6745d1bbc061d18a2e1385
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f8e71397b0e78c66a6745d1bbc061d18a2e1385

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>
(cherry picked from commit 04459c82874b648a9c3ed4c9384b831772bb07e6)

---

 .pick_status.json                    |  2 +-
 src/amd/vulkan/radv_pipeline_cache.c | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 7effdadc6a0..8bed3157de3 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -112,7 +112,7 @@
         "description": "radv: Fix RTPSO hashing of pGroups.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "ca2d96db51e5a47044ee02f8613bc463605c2bf8"
     },
diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c
index 238f6a3ea1d..42c1aaf8918 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