From eb585d63ca4cc10800f41c9658f43f85fa932f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 8 Feb 2023 12:10:29 +0100 Subject: [PATCH] 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(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 Reviewed-by: Marc Mutz --- src/gui/rhi/qrhid3d12_p_p.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/rhi/qrhid3d12_p_p.h b/src/gui/rhi/qrhid3d12_p_p.h index 8a061d8506..4f1717e2bd 100644 --- a/src/gui/rhi/qrhid3d12_p_p.h +++ b/src/gui/rhi/qrhid3d12_p_p.h @@ -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;