diff options
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 55 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.h | 7 |
2 files changed, 62 insertions, 0 deletions
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 3dc06ae60e..406fcdd226 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1676,6 +1676,61 @@ void QOpenGLMultiGroupSharedResource::cleanup(QOpenGLContextGroup *group, QOpenG m_groups.removeOne(group); } +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp) +{ + QDebugStateSaver saver(debug); + debug.nospace(); + debug << "QOpenGLVersionProfile("; + if (vp.isValid()) { + debug << vp.version().first << '.' << vp.version().second + << ", profile=" << vp.profile(); + } else { + debug << "invalid"; + } + debug << ')'; + return debug; +} + +QDebug operator<<(QDebug debug, const QOpenGLContext *ctx) +{ + QDebugStateSaver saver(debug); + debug.nospace(); + debug.noquote(); + debug << "QOpenGLContext("; + if (ctx) { + debug << static_cast<const void *>(ctx); + if (ctx->isValid()) { + debug << ", nativeHandle=" << ctx->nativeHandle() + << ", format=" << ctx->format(); + if (const QSurface *sf = ctx->surface()) + debug << ", surface=" << sf; + if (const QScreen *s = ctx->screen()) + debug << ", screen=\"" << s->name() << '"'; + } else { + debug << ", invalid"; + } + } else { + debug << '0'; + } + debug << ')'; + return debug; +} + +QDebug operator<<(QDebug debug, const QOpenGLContextGroup *cg) +{ + QDebugStateSaver saver(debug); + debug.nospace(); + debug << "QOpenGLContextGroup("; + if (cg) + debug << cg->shares(); + else + debug << '0'; + debug << ')'; + return debug; +} +#endif // QT_NO_DEBUG_STREAM + #include "moc_qopenglcontext.cpp" QT_END_NAMESPACE diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index 3ec9ce3188..07153db84e 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -69,6 +69,7 @@ QT_BEGIN_NAMESPACE +class QDebug; class QOpenGLContextPrivate; class QOpenGLContextGroupPrivate; class QOpenGLFunctions; @@ -249,6 +250,12 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_screenDestroyed(QObject *object)) }; +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp); +Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLContext *ctx); +Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLContextGroup *cg); +#endif // !QT_NO_DEBUG_STREAM + QT_END_NAMESPACE #endif // QT_NO_OPENGL |