From 66a0d8204f775bd32bad68c42d4fec223272f9e0 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 18 Oct 2021 11:48:33 -0400 Subject: [PATCH] zink: reduce hashed region of zink_descriptor_layout_key only the first 3 members of VkDescriptorSetLayoutBinding are useful here Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_descriptors.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c index a8272b2fea1..4d946e7d1a3 100644 --- a/src/gallium/drivers/zink/zink_descriptors.c +++ b/src/gallium/drivers/zink/zink_descriptors.c @@ -388,7 +388,9 @@ hash_descriptor_layout(const void *key) uint32_t hash = 0; const struct zink_descriptor_layout_key *k = key; hash = XXH32(&k->num_bindings, sizeof(unsigned), hash); - hash = XXH32(k->bindings, k->num_bindings * sizeof(VkDescriptorSetLayoutBinding), hash); + /* only hash first 3 members: no holes and the rest are always constant */ + for (unsigned i = 0; i < k->num_bindings; i++) + hash = XXH32(&k->bindings[i], offsetof(VkDescriptorSetLayoutBinding, stageFlags), hash); return hash; }