From 7b6d200503e036603a252ef8de72110f5afcf11d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 10 May 2017 10:48:14 +0200 Subject: [PATCH] Add debug operator for QOpenGLTexture Change-Id: If87730725d9eba8d4c1e0158056cdeaa7c1bc12f Reviewed-by: Shawn Rutledge --- src/gui/opengl/qopengltexture.cpp | 37 +++++++++++++++++++++++++++++++ src/gui/opengl/qopengltexture.h | 9 ++++++++ 2 files changed, 46 insertions(+) diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 4d0ba212ab..3563f1b5d3 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -43,6 +43,7 @@ #include "qopenglfunctions.h" #include #include +#include #include #include @@ -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 diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h index 6e6f7ef1f2..12d9b91603 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/gui/opengl/qopengltexture.h @@ -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