summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qshader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/rhi/qshader.cpp')
-rw-r--r--src/gui/rhi/qshader.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp
index 18d0fdef05..2c1b333259 100644
--- a/src/gui/rhi/qshader.cpp
+++ b/src/gui/rhi/qshader.cpp
@@ -545,10 +545,12 @@ bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW
*/
size_t qHash(const QShader &s, size_t seed) Q_DECL_NOTHROW
{
- size_t h = s.stage();
- for (auto it = s.d->shaders.constBegin(), itEnd = s.d->shaders.constEnd(); it != itEnd; ++it)
- h += qHash(it.key(), seed) + qHash(it.value().shader(), seed);
- return h;
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, s.stage());
+ seed = qHashRange(s.d->shaders.keyValueBegin(),
+ s.d->shaders.keyValueEnd(),
+ seed);
+ return seed;
}
/*!
@@ -598,7 +600,11 @@ bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) Q_DECL_NOTHROW
*/
size_t qHash(const QShaderKey &k, size_t seed) Q_DECL_NOTHROW
{
- return seed + 10 * k.source() + k.sourceVersion().version() + k.sourceVersion().flags() + k.sourceVariant();
+ return qHashMulti(seed,
+ k.source(),
+ k.sourceVersion().version(),
+ k.sourceVersion().flags(),
+ k.sourceVariant());
}
/*!
@@ -620,6 +626,16 @@ bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) Q_DECL_NOTHROW
\relates QShaderCode
*/
+/*!
+ Returns the hash value for \a k, using \a seed to seed the calculation.
+
+ \relates QShaderCode
+ */
+size_t qHash(const QShaderCode &k, size_t seed) noexcept
+{
+ return qHash(k.shader(), seed);
+}
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QShader &bs)
{