QRhiD3D11: fix qHash() to use qHashMulti()

The old code used XOR to combine hash values, but XOR is a bad combiner,
since it's mixing the bits insufficiently (XORing the same value again
will e.g. undo the original change).

This is a private class, so there are no users outside of Qt that would
have inlined this qHash() function; therefore, we are free to change the
algorithm.

Change-Id: I7970e52ef4bd3b6a2248fffda0d4d75eb4afdf5a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7bf9beb300db40835464c5b82da83cd8d49573c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2025-03-18 10:53:02 -07:00 committed by Qt Cherry-pick Bot
parent db33112d4d
commit f2b58861d2

View File

@ -865,7 +865,7 @@ inline bool operator!=(const QRhiD3D11::BytecodeCacheKey &a, const QRhiD3D11::By
inline size_t qHash(const QRhiD3D11::BytecodeCacheKey &k, size_t seed = 0) noexcept
{
return qHash(k.sourceHash, seed) ^ qHash(k.target) ^ qHash(k.entryPoint) ^ k.compileFlags;
return qHashMulti(seed, k.sourceHash, k.target, k.entryPoint, k.compileFlags);
}
QT_END_NAMESPACE