Move qHash function for a Windows type into global namespace

Otherwise leads to QHash being unable to find it upon usage:
qtbase/src/corelib/tools/qhash.h(64): error C2338: static_assert failed: 'The key type must have a qHash overload or a std::hash specialization'
qtbase/src/corelib/tools/qhash.h(665): note: see reference to function template instantiation 'size_t qt::QHashPrivate::calculateHash<D3D12_SAMPLER_DESC>(const T &,size_t)' being compiled

Since we rely on ADL for qHash the qHash overload should live in the
same scope as the original type.

Change-Id: I701447c49076980a1aed47d64ba8ac3358cf8b1c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Mårten Nordheim 2023-02-08 12:10:29 +01:00
parent a1867208a6
commit eb585d63ca

View File

@ -30,6 +30,11 @@
#include "D3D12MemAlloc.h"
inline size_t qHash(const D3D12_SAMPLER_DESC &s, size_t seed = 0) noexcept
{
return QT_PREPEND_NAMESPACE(qHashBits)(&s, sizeof(s), seed);
}
QT_BEGIN_NAMESPACE
static const int QD3D12_FRAMES_IN_FLIGHT = 2;
@ -462,11 +467,6 @@ inline bool operator!=(const D3D12_SAMPLER_DESC &a, const D3D12_SAMPLER_DESC &b)
return !(a == b);
}
inline size_t qHash(const D3D12_SAMPLER_DESC &s, size_t seed = 0) noexcept
{
return qHashBits(&s, sizeof(s), seed);
}
struct QD3D12SamplerManager
{
const quint32 MAX_SAMPLERS = 512;