Commit 0856f98d authored by Laszlo Agocs's avatar Laszlo Agocs

Make srb debug printable

parent 0a1f38d5
......@@ -1982,6 +1982,49 @@ uint qHash(const QRhiShaderResourceBinding &b, uint seed)
+ qHash(QByteArray::fromRawData(u, sizeof(b.d->u)), seed);
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiShaderResourceBinding &b)
{
const QRhiShaderResourceBindingPrivate *d = b.d;
QDebugStateSaver saver(dbg);
dbg.nospace() << "QRhiShaderResourceBinding("
<< "binding=" << d->binding
<< " stage=" << d->stage
<< " type=" << d->type;
switch (d->type) {
case QRhiShaderResourceBinding::UniformBuffer:
dbg.nospace() << " UniformBuffer("
<< "buffer=" << d->u.ubuf.buf
<< " offset=" << d->u.ubuf.offset
<< " maybeSize=" << d->u.ubuf.maybeSize
<< ')';
break;
case QRhiShaderResourceBinding::SampledTexture:
dbg.nospace() << " SampledTexture("
<< "texture=" << d->u.stex.tex
<< " sampler=" << d->u.stex.sampler
<< ')';
break;
default:
Q_UNREACHABLE();
break;
}
dbg.nospace() << ')';
return dbg;
}
#endif
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiShaderResourceBindings &srb)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QRhiShaderResourceBindings("
<< srb.m_bindings
<< ')';
return dbg;
}
#endif
/*!
\class QRhiGraphicsPipeline
\inmodule QtRhi
......
......@@ -280,6 +280,9 @@ private:
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);
#ifndef QT_NO_DEBUG_STREAM
friend Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBinding &);
#endif
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiShaderResourceBinding::StageFlags)
......@@ -287,6 +290,9 @@ 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);
#ifndef QT_NO_DEBUG_STREAM
Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBinding &);
#endif
class Q_RHI_EXPORT QRhiColorAttachment
{
......@@ -786,8 +792,15 @@ protected:
QRhiShaderResourceBindings(QRhiImplementation *rhi);
QVector<QRhiShaderResourceBinding> m_bindings;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
#ifndef QT_NO_DEBUG_STREAM
friend Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBindings &);
#endif
};
#ifndef QT_NO_DEBUG_STREAM
Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBindings &);
#endif
class Q_RHI_EXPORT QRhiGraphicsPipeline : public QRhiResource
{
public:
......
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