Giovanni Mascellani (@giomasce) commented about libs/vkd3d/cache.c:
+{ + struct vkd3d_cache_object_v1 d; + struct rb_entry entry; /* Entry in the hash table. */ + uint8_t *payload; /* App key + value. Separate allocation to allow eviction. */ +}; + +static int vkd3d_shader_cache_compare_key(const void *key, const struct rb_entry *entry) +{ + const uint64_t *k = key; + const struct shader_cache_entry *e = RB_ENTRY_VALUE(entry, struct shader_cache_entry, entry); + + if (*k < e->d.hash) + return -1; + if (*k > e->d.hash) + return 1; + return 0; This only works as far as you keep this "experimental mode" in which you nuke the universe as soon as you find a collision. As soon as you want to fix that, the RB tree comparison function must be aware of the full key as well.
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/541#note_57177