summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaglcontext.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-07-18 20:35:15 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-07-18 19:20:36 +0000
commit519fcb38a2b9e2c4490e8a3c740ad43227a71b77 (patch)
treef7017092d9afda572d111f05560504610a04fb31 /src/plugins/platforms/cocoa/qcocoaglcontext.mm
parent32591b660e498e9e1178fad1fd0070c6aaea8177 (diff)
macOS: Add categorized logging to QCocoaGLContext
Change-Id: I0fa37457f91d905ed6fb8a2aba20add311705ec7 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaglcontext.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm12
1 files changed, 7 insertions, 5 deletions
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<QCocoaNativeContext>()) {
- qWarning("QCocoaGLContext: Requires a QCocoaNativeContext");
+ qCWarning(lcQpaOpenGLContext, "QOpenGLContext native handle must be a QCocoaNativeContext");
return;
}
QCocoaNativeContext handle = nativeHandle.value<QCocoaNativeContext>();
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;
}