From 519fcb38a2b9e2c4490e8a3c740ad43227a71b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 18 Jul 2018 20:35:15 +0200 Subject: macOS: Add categorized logging to QCocoaGLContext Change-Id: I0fa37457f91d905ed6fb8a2aba20add311705ec7 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 348a9b0c24..35fa8d0c34 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaOpenGLContext, "qt.qpa.openglcontext"); + static inline QByteArray getGlString(GLenum param) { if (const GLubyte *s = glGetString(param)) @@ -129,13 +131,13 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo { if (!nativeHandle.isNull()) { if (!nativeHandle.canConvert()) { - qWarning("QCocoaGLContext: Requires a QCocoaNativeContext"); + qCWarning(lcQpaOpenGLContext, "QOpenGLContext native handle must be a QCocoaNativeContext"); return; } QCocoaNativeContext handle = nativeHandle.value(); NSOpenGLContext *context = handle.context(); if (!context) { - qWarning("QCocoaGLContext: No NSOpenGLContext given"); + qCWarning(lcQpaOpenGLContext, "QCocoaNativeContext's NSOpenGLContext can not be null"); return; } m_context = context; @@ -186,16 +188,16 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo // retry without sharing on context creation failure. if (!m_context && m_shareContext) { + qCWarning(lcQpaOpenGLContext, "Could not create NSOpenGLContext with shared context, " + "falling back to unshared context."); m_shareContext = nil; m_context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil]; - if (m_context) - qWarning("QCocoaGLContext: Falling back to unshared context."); } // give up if we still did not get a native context [pixelFormat release]; if (!m_context) { - qWarning("QCocoaGLContext: Failed to create context."); + qCWarning(lcQpaOpenGLContext, "Failed to create NSOpenGLContext"); return; } -- cgit v1.2.3