Add debug operator for QOpenGLTexture

Change-Id: If87730725d9eba8d4c1e0158056cdeaa7c1bc12f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Friedemann Kleint 2017-05-10 10:48:14 +02:00
parent 6a8a93a2a1
commit 7b6d200503
2 changed files with 46 additions and 0 deletions

View File

@ -43,6 +43,7 @@
#include "qopenglfunctions.h"
#include <QtGui/qcolor.h>
#include <QtGui/qopenglcontext.h>
#include <QtCore/qdebug.h>
#include <private/qobject_p.h>
#include <private/qopenglcontext_p.h>
@ -4670,4 +4671,40 @@ float QOpenGLTexture::levelofDetailBias() const
return d->levelOfDetailBias;
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const QOpenGLTexture *t)
{
QDebugStateSaver saver(debug);
debug.nospace();
debug << "QOpenGLTexture(";
if (t) {
const QOpenGLTexturePrivate *d = t->d_ptr.data();
debug << d->target << ", bindingTarget=" << d->bindingTarget
<< ", size=[" << d->dimensions[0]
<< ", " << d->dimensions[1];
if (d->target == QOpenGLTexture::Target3D)
debug << ", " << d->dimensions[2];
debug << "], format=" << d->format << ", formatClass=" << d->formatClass;
if (t->isCreated())
debug << ", textureId=" << d->textureId;
if (t->isBound())
debug << ", [bound]";
if (t->isTextureView())
debug << ", [view]";
if (d->fixedSamplePositions)
debug << ", [fixedSamplePositions]";
debug << ", mipLevels=" << d->requestedMipLevels << ", layers=" << d->layers
<< ", faces=" << d->faces << ", samples=" << d->samples
<< ", depthStencilMode=" << d->depthStencilMode << ", comparisonFunction="
<< d->comparisonFunction << ", comparisonMode=" << d->comparisonMode
<< ", features=" << d->features << ", minificationFilter=" << d->minFilter
<< ", magnificationFilter=" << d->magFilter << ", wrapMode=" << d->wrapModes[0];
} else {
debug << '0';
}
debug << ')';
return debug;
}
#endif // QT_NO_DEBUG_STREAM
QT_END_NAMESPACE

View File

@ -50,6 +50,7 @@
QT_BEGIN_NAMESPACE
class QDebug;
class QOpenGLTexturePrivate;
class QOpenGLPixelTransferOptions;
@ -613,6 +614,10 @@ public:
void setLevelofDetailBias(float bias);
float levelofDetailBias() const;
#ifndef QT_NO_DEBUG_STREAM
friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QOpenGLTexture *t);
#endif
private:
Q_DISABLE_COPY(QOpenGLTexture)
Q_DECLARE_PRIVATE(QOpenGLTexture)
@ -621,6 +626,10 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLTexture::Features)
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLTexture *t);
#endif
QT_END_NAMESPACE
#endif // QT_NO_OPENGL