diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/macos_context_type_helper.h | 1 | ||||
-rw-r--r-- | src/core/macos_context_type_helper.mm | 5 | ||||
-rw-r--r-- | src/core/ozone/gl_share_context_qt.cpp | 7 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/core/macos_context_type_helper.h b/src/core/macos_context_type_helper.h index d234a2bff..a7b989bc3 100644 --- a/src/core/macos_context_type_helper.h +++ b/src/core/macos_context_type_helper.h @@ -39,4 +39,5 @@ #ifndef MACOS_CONTEXT_TYPE_HELPER_H_ #define MACOS_CONTEXT_TYPE_HELPER_H_ bool isCurrentContextSoftware(); +void* cglContext(NSOpenGLContext*); #endif // MACOS_CONTEXT_TYPE_HELPER_H_ diff --git a/src/core/macos_context_type_helper.mm b/src/core/macos_context_type_helper.mm index c814d2849..4c9302482 100644 --- a/src/core/macos_context_type_helper.mm +++ b/src/core/macos_context_type_helper.mm @@ -47,3 +47,8 @@ bool isCurrentContextSoftware() [NSOpenGLContext.currentContext getValues:&rendererID forParameter:NSOpenGLContextParameterCurrentRendererID]; return (rendererID & kCGLRendererIDMatchingMask) == kCGLRendererGenericFloatID; } + +void* cglContext(NSOpenGLContext *nsOpenGLContext) +{ + return [nsOpenGLContext CGLContextObj]; +} diff --git a/src/core/ozone/gl_share_context_qt.cpp b/src/core/ozone/gl_share_context_qt.cpp index dbfb7848f..669652057 100644 --- a/src/core/ozone/gl_share_context_qt.cpp +++ b/src/core/ozone/gl_share_context_qt.cpp @@ -41,6 +41,9 @@ #include <QtGui/qtgui-config.h> #include <qpa/qplatformnativeinterface.h> #include <QtGui/qopenglcontext_platform.h> +#if defined(Q_OS_MACOS) +#include "macos_context_type_helper.h" +#endif #if QT_CONFIG(opengl) #include <QOpenGLContext> #include <QOpenGLExtraFunctions> @@ -55,6 +58,8 @@ QtShareGLContext::QtShareGLContext(QOpenGLContext *qtContext) QOpenGLContext *context = QOpenGLContext::globalShareContext(); #if defined(Q_OS_MACOS) auto *ctx = context->platformInterface<QPlatformInterface::QCocoaGLContext>(); + if (ctx) + m_handle = cglContext(ctx->nativeContext()); #endif #if defined(Q_OS_WIN) auto *ctx = context->platformInterface<QPlatformInterface::QWGLContext>(); @@ -62,7 +67,7 @@ QtShareGLContext::QtShareGLContext(QOpenGLContext *qtContext) #if defined(Q_OS_LINUX) auto *ctx = context->platformInterface<QPlatformInterface::QGLXContext>(); #endif - if (ctx) + if (ctx && !m_handle) m_handle = (void *)ctx->nativeContext(); #if QT_CONFIG(egl) if (!m_handle) { |