Commit 90a6fdfd authored by Laszlo Agocs's avatar Laszlo Agocs

Make clear/input/stage objects qDebug-printable

Plus a small doc enhancement for viewport/scissor.
parent 935aa354
......@@ -454,6 +454,20 @@ uint qHash(const QRhiColorClearValue &v, uint seed) Q_DECL_NOTHROW
return qFloor((c.x() + c.y() + c.z() + c.w()) * 1000) + seed;
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiColorClearValue &v)
{
QDebugStateSaver saver(dbg);
const QVector4D c = v.rgba();
dbg.nospace() << "QRhiColorClearValue(r=" << c.x()
<< " g=" << c.y()
<< " b=" << c.z()
<< " a=" << c.w()
<< ')';
return dbg;
}
#endif
/*!
\class QRhiDepthStencilClearValue
\inmodule QtRhi
......@@ -513,6 +527,17 @@ uint qHash(const QRhiDepthStencilClearValue &v, uint seed) Q_DECL_NOTHROW
return seed * (qFloor(v.depthClearValue() * 100) + v.stencilClearValue());
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiDepthStencilClearValue &v)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QRhiDepthStencilClearValue(depth-clear=" << v.depthClearValue()
<< " stencil-clear=" << v.stencilClearValue()
<< ')';
return dbg;
}
#endif
/*!
\class QRhiViewport
\inmodule QtRhi
......@@ -600,6 +625,22 @@ uint qHash(const QRhiViewport &v, uint seed) Q_DECL_NOTHROW
return seed + r.x() + r.y() + r.z() + r.w() + qFloor(v.minDepth() * 100) + qFloor(v.maxDepth() * 100);
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiViewport &v)
{
QDebugStateSaver saver(dbg);
const QVector4D r = v.viewport();
dbg.nospace() << "QRhiViewport(bottom-left-x=" << r.x()
<< " bottom-left-y=" << r.y()
<< " width=" << r.z()
<< " height=" << r.w()
<< " minDepth=" << v.minDepth()
<< " maxDepth=" << v.maxDepth()
<< ')';
return dbg;
}
#endif
/*!
\class QRhiScissor
\inmodule QtRhi
......@@ -666,6 +707,20 @@ uint qHash(const QRhiScissor &v, uint seed) Q_DECL_NOTHROW
return seed + r.x() + r.y() + r.z() + r.w();
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiScissor &s)
{
QDebugStateSaver saver(dbg);
const QVector4D r = s.scissor();
dbg.nospace() << "QRhiScissor(bottom-left-x=" << r.x()
<< " bottom-left-y=" << r.y()
<< " width=" << r.z()
<< " height=" << r.w()
<< ')';
return dbg;
}
#endif
/*!
\class QRhiVertexInputBinding
\inmodule QtRhi
......@@ -781,6 +836,18 @@ uint qHash(const QRhiVertexInputBinding &v, uint seed) Q_DECL_NOTHROW
return seed + v.stride() + v.classification();
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiVertexInputBinding &b)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QRhiVertexInputBinding(stride=" << b.stride()
<< " cls=" << b.classification()
<< " step-rate=" << b.instanceStepRate()
<< ')';
return dbg;
}
#endif
/*!
\class QRhiVertexInputAttribute
\inmodule QtRhi
......@@ -917,6 +984,19 @@ uint qHash(const QRhiVertexInputAttribute &v, uint seed) Q_DECL_NOTHROW
return seed + v.binding() + v.location() + v.format() + v.offset();
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiVertexInputAttribute &a)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QRhiVertexInputAttribute(binding=" << a.binding()
<< " location=" << a.location()
<< " format=" << a.format()
<< " offset=" << a.offset()
<< ')';
return dbg;
}
#endif
/*!
\class QRhiVertexInputLayout
\inmodule QtRhi
......@@ -966,6 +1046,17 @@ uint qHash(const QRhiVertexInputLayout &v, uint seed) Q_DECL_NOTHROW
return qHash(v.bindings(), seed) + qHash(v.attributes(), seed);
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiVertexInputLayout &v)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QRhiVertexInputLayout(bindings=" << v.bindings()
<< " attributes=" << v.attributes()
<< ')';
return dbg;
}
#endif
/*!
\class QRhiGraphicsShaderStage
\inmodule QtRhi
......@@ -1045,6 +1136,18 @@ uint qHash(const QRhiGraphicsShaderStage &v, uint seed) Q_DECL_NOTHROW
return v.type() + qHash(v.shader(), seed) + v.shaderVariant();
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QRhiGraphicsShaderStage &s)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QRhiGraphicsShaderStage(type=" << s.type()
<< " shader=" << s.shader()
<< " variant=" << s.shaderVariant()
<< ')';
return dbg;
}
#endif
/*!
\class QRhiColorAttachment
\inmodule QtRhi
......@@ -3736,6 +3839,11 @@ void QRhiCommandBuffer::setVertexInput(int startBinding, const QVector<VertexInp
/*!
Records setting the active viewport rectangle specified in \a viewport.
With backends where the underlying graphics API has scissoring always
enabled, this function also sets the scissor to match the viewport whenever
the active QRhiGraphicsPipeline does not have
\l{QRhiGraphicsPipeline::UsesScissor}{UsesScissor} set.
\note QRhi assumes OpenGL-style viewport coordinates, meaning x and y are
bottom-left.
......@@ -3751,7 +3859,9 @@ void QRhiCommandBuffer::setViewport(const QRhiViewport &viewport)
Records setting the active scissor rectangle specified in \a scissor.
This can only be called when the bound pipeline has
QRhiGraphicsPipeline::UsesScissor set.
\l{QRhiGraphicsPipeline::UsesScissor}{UsesScissor} set. When the flag is
set on the active pipeline, this function must be called because scissor
testing will get enabled and so a scissor rectangle must be provided.
\note QRhi assumes OpenGL-style viewport coordinates, meaning x and y are
bottom-left.
......
......@@ -81,6 +81,9 @@ Q_DECLARE_TYPEINFO(QRhiColorClearValue, Q_MOVABLE_TYPE);
Q_RHI_EXPORT bool operator==(const QRhiColorClearValue &a, const QRhiColorClearValue &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT bool operator!=(const QRhiColorClearValue &a, const QRhiColorClearValue &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT uint qHash(const QRhiColorClearValue &v, uint seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiColorClearValue &);
#endif
class Q_RHI_EXPORT QRhiDepthStencilClearValue
{
......@@ -104,6 +107,9 @@ Q_DECLARE_TYPEINFO(QRhiDepthStencilClearValue, Q_MOVABLE_TYPE);
Q_RHI_EXPORT bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT uint qHash(const QRhiDepthStencilClearValue &v, uint seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiDepthStencilClearValue &);
#endif
class Q_RHI_EXPORT QRhiViewport
{
......@@ -131,6 +137,9 @@ Q_DECLARE_TYPEINFO(QRhiViewport, Q_MOVABLE_TYPE);
Q_RHI_EXPORT bool operator==(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT bool operator!=(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT uint qHash(const QRhiViewport &v, uint seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiViewport &);
#endif
class Q_RHI_EXPORT QRhiScissor
{
......@@ -150,6 +159,9 @@ Q_DECLARE_TYPEINFO(QRhiScissor, Q_MOVABLE_TYPE);
Q_RHI_EXPORT bool operator==(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT bool operator!=(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT uint qHash(const QRhiScissor &v, uint seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiScissor &);
#endif
class Q_RHI_EXPORT QRhiVertexInputBinding
{
......@@ -183,6 +195,9 @@ Q_DECLARE_TYPEINFO(QRhiVertexInputBinding, Q_MOVABLE_TYPE);
Q_RHI_EXPORT bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT uint qHash(const QRhiVertexInputBinding &v, uint seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputBinding &);
#endif
class Q_RHI_EXPORT QRhiVertexInputAttribute
{
......@@ -225,6 +240,9 @@ Q_DECLARE_TYPEINFO(QRhiVertexInputAttribute, Q_MOVABLE_TYPE);
Q_RHI_EXPORT bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT uint qHash(const QRhiVertexInputAttribute &v, uint seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputAttribute &);
#endif
class Q_RHI_EXPORT QRhiVertexInputLayout
{
......@@ -248,6 +266,9 @@ Q_DECLARE_TYPEINFO(QRhiVertexInputLayout, Q_MOVABLE_TYPE);
Q_RHI_EXPORT bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT uint qHash(const QRhiVertexInputLayout &v, uint seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &);
#endif
class Q_RHI_EXPORT QRhiGraphicsShaderStage
{
......@@ -285,6 +306,9 @@ Q_DECLARE_TYPEINFO(QRhiGraphicsShaderStage, Q_MOVABLE_TYPE);
Q_RHI_EXPORT bool operator==(const QRhiGraphicsShaderStage &a, const QRhiGraphicsShaderStage &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT bool operator!=(const QRhiGraphicsShaderStage &a, const QRhiGraphicsShaderStage &b) Q_DECL_NOTHROW;
Q_RHI_EXPORT uint qHash(const QRhiGraphicsShaderStage &s, uint seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_RHI_EXPORT QDebug operator<<(QDebug, const QRhiGraphicsShaderStage &);
#endif
class Q_RHI_EXPORT QRhiShaderResourceBinding
{
......
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