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 <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30089>
This commit is contained in:
Samuel Pitoiset
2024-07-09 11:55:25 +02:00
committed by Marge Bot
parent 2c28ed7c5c
commit 51c6910ba7
2 changed files with 3 additions and 2 deletions

View File

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

View File

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