Clean up Hash Functions

Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934
* Clean up usage of murmur3
* Fixed usages of binary murmur3 on floats (this is invalid)
* Changed DJB2 to use xor (which seems to be better)
This commit is contained in:
reduz 2022-06-18 16:20:55 +02:00
parent 8e3d9a23aa
commit 141c375581
40 changed files with 391 additions and 236 deletions

View file

@ -457,17 +457,17 @@ class RenderingDeviceVulkan : public RenderingDevice {
uint32_t hash() const {
int vdc = vertex_formats.size();
uint32_t h = hash_djb2_one_32(vdc);
uint32_t h = hash_murmur3_one_32(vdc);
const VertexAttribute *ptr = vertex_formats.ptr();
for (int i = 0; i < vdc; i++) {
const VertexAttribute &vd = ptr[i];
h = hash_djb2_one_32(vd.location, h);
h = hash_djb2_one_32(vd.offset, h);
h = hash_djb2_one_32(vd.format, h);
h = hash_djb2_one_32(vd.stride, h);
h = hash_djb2_one_32(vd.frequency, h);
h = hash_murmur3_one_32(vd.location, h);
h = hash_murmur3_one_32(vd.offset, h);
h = hash_murmur3_one_32(vd.format, h);
h = hash_murmur3_one_32(vd.stride, h);
h = hash_murmur3_one_32(vd.frequency, h);
}
return h;
return hash_fmix32(h);
}
};