From 51c6910ba7002d99158a571e67360a7241949360 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 9 Jul 2024 11:55:25 +0200 Subject: [PATCH] radv: use blake3 for hashing descriptor set layouts It's faster than sha1, up to 28% with 1M of bindings. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9476 Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_descriptor_set.c | 2 +- src/amd/vulkan/radv_descriptor_set.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index dea44ec2905..2a303f6335b 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -370,7 +370,7 @@ radv_CreateDescriptorSetLayout(VkDevice _device, const VkDescriptorSetLayoutCrea * should be ok. */ uint32_t hash_offset = offsetof(struct radv_descriptor_set_layout, hash) + sizeof(set_layout->hash); - _mesa_sha1_compute((const char *)set_layout + hash_offset, size - hash_offset, set_layout->hash); + _mesa_blake3_compute((const char *)set_layout + hash_offset, size - hash_offset, set_layout->hash); *pSetLayout = radv_descriptor_set_layout_to_handle(set_layout); diff --git a/src/amd/vulkan/radv_descriptor_set.h b/src/amd/vulkan/radv_descriptor_set.h index 8947011feec..a81ad93e45f 100644 --- a/src/amd/vulkan/radv_descriptor_set.h +++ b/src/amd/vulkan/radv_descriptor_set.h @@ -7,6 +7,7 @@ #ifndef RADV_DESCRIPTOR_SET_H #define RADV_DESCRIPTOR_SET_H +#include "util/mesa-blake3.h" #include "util/mesa-sha1.h" #include "radv_constants.h" @@ -40,7 +41,7 @@ struct radv_descriptor_set_layout { struct vk_descriptor_set_layout vk; /* Hash of all fields below */ - uint8_t hash[SHA1_DIGEST_LENGTH]; + blake3_hash hash; /* Everything below is hashed and shouldn't contain any pointers. Be careful when modifying this * structure.