Mesa (main): zink: reduce hashed region of zink_descriptor_layout_key

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 26 14:39:12 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Oct 18 11:48:33 2021 -0400

zink: reduce hashed region of zink_descriptor_layout_key

only the first 3 members of VkDescriptorSetLayoutBinding are useful here

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13483>

---

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



More information about the mesa-commit mailing list