macOS: disable threaded OpenGL (unconditionally)

We can’t determine when the app will use layer-backed
views without having access to the QWindow and NSView
instance, so make the conservative choice of always
returning false for ThreadedOpenGL.

Task-number: QTBUG-74820
Change-Id: If2779b17eead78ce1929ccebc3bd8fc0eb00c4b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Johan Sørvig 2019-04-11 11:44:36 +02:00 committed by Jani Heikkinen
parent 0b693175e4
commit fc3e851414

View File

@ -347,11 +347,13 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
switch (cap) {
#ifndef QT_NO_OPENGL
case ThreadedOpenGL:
// AppKit expects rendering to happen on the main thread, and we can
// easily end up in situations where rendering on secondary threads
// will result in visual artifacts, bugs, or even deadlocks, when
// building with SDK 10.14 or higher which enbles view layer-backing.
return QMacVersion::buildSDK() < QOperatingSystemVersion(QOperatingSystemVersion::MacOSMojave);
// Qt's threaded OpenGL implementation does not work well for layer-backed
// views, where we can easily end up in situations where rendering on secondary
// threads will result in visual artifacts, bugs, or even deadlocks. It is
// not possible to determine here if the the app will be using layer-backed
// views (it can opt-in using SDK 10.14+ on macOS 10.4+, or by setting
// NSWindow flags such as NSWindowStyleMaskFullSizeContentView).
return false;
case OpenGL:
case BufferQueueingOpenGL:
#endif