Commit 0a1f38d5 authored by Laszlo Agocs's avatar Laszlo Agocs

Make QRhiShaderResourceBinding hashable

parent f8a1f630
......@@ -1975,6 +1975,13 @@ bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind
return !(a == b);
}
uint qHash(const QRhiShaderResourceBinding &b, uint seed)
{
const char *u = reinterpret_cast<const char *>(&b.d->u);
return seed + b.d->binding + 10 * b.d->stage + 100 * b.d->type
+ qHash(QByteArray::fromRawData(u, sizeof(b.d->u)), seed);
}
/*!
\class QRhiGraphicsPipeline
\inmodule QtRhi
......
......@@ -279,12 +279,14 @@ private:
friend class QRhiShaderResourceBindingPrivate;
friend Q_RHI_EXPORT bool operator==(const QRhiShaderResourceBinding &, const QRhiShaderResourceBinding &);
friend Q_RHI_EXPORT bool operator!=(const QRhiShaderResourceBinding &, const QRhiShaderResourceBinding &);
friend Q_RHI_EXPORT uint qHash(const QRhiShaderResourceBinding &, uint);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiShaderResourceBinding::StageFlags)
Q_RHI_EXPORT bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b);
Q_RHI_EXPORT bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b);
Q_RHI_EXPORT uint qHash(const QRhiShaderResourceBinding &b, uint seed = 0);
class Q_RHI_EXPORT QRhiColorAttachment
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment