summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <[email protected]>2025-07-08 16:17:00 +0200
committerTor Arne Vestbø <[email protected]>2025-07-09 23:46:42 +0200
commita9ca1aef2291abea36bba9b934f154ea9866337d (patch)
treeb8e7c6c4baf7add525930725b36e4634fa9fafc3
parente60f6c1b48be74275b808d15075f6cc289c7d919 (diff)
Disable QPlatformIntegration::Capability::OpenGL on macOS 26 in VMsHEADdev
Or rather, when detecting that the software GL renderer is in use, which is the case in VMs, or when requesting Qt::AA_UseSoftwareOpenGL explictly. In this situation macOS 26 crashes in [NSOpenGLContext flushBuffer] and [NSOpenGLContext setView:], making it unusable. Hopefully this issue is resolved in the platform, but for now we report lack of OpenGL so we can get our tests passing/skipping in CI. Change-Id: I68412aed5174194c80d2b079ffba141f9f2a3be1 Reviewed-by: Volker Hilsheimer <[email protected]>
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm8
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm18
3 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h
index 36546879ae4..13139dd399d 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h
@@ -43,6 +43,8 @@ public:
QFunctionPointer getProcAddress(const char *procName) override;
+ bool isSoftwareContext() const;
+
private:
static NSOpenGLPixelFormat *pixelFormatForSurfaceFormat(const QSurfaceFormat &format);
@@ -54,6 +56,7 @@ private:
QSurfaceFormat m_format;
QVarLengthArray<QMacNotificationObserver, 3> m_updateObservers;
QAtomicInt m_needsUpdate = false;
+ bool m_isSoftwareContext = false;
#ifndef QT_NO_DEBUG_STREAM
friend QDebug operator<<(QDebug debug, const QCocoaGLContext *screen);
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index bfac716b633..2f0f513dfc1 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -289,6 +289,9 @@ void QCocoaGLContext::updateSurfaceFormat()
else
m_format.setSwapBehavior(QSurfaceFormat::SingleBuffer);
+ m_isSoftwareContext = (pixelFormatAttribute(NSOpenGLPFARendererID)
+ & kCGLRendererIDMatchingMask) == kCGLRendererGenericFloatID;
+
// ------------------- Query the context -------------------
auto glContextParameter = [&](NSOpenGLContextParameter parameter) {
@@ -512,6 +515,11 @@ bool QCocoaGLContext::isSharing() const
return m_shareContext != nil;
}
+bool QCocoaGLContext::isSoftwareContext() const
+{
+ return m_isSoftwareContext;
+}
+
NSOpenGLContext *QCocoaGLContext::nativeContext() const
{
return m_context;
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 8c6dcfd4f60..4c5975af34a 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -232,6 +232,24 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
// layer-backed.
return false;
case OpenGL:
+ if (QOperatingSystemVersion::current() > QOperatingSystemVersion::MacOSSonoma) {
+ // Tahoe has issues with software-backed GL, crashing in common operations
+ static bool isSoftwareContext = []{
+ QOpenGLContext context;
+ context.create();
+ auto *cocoaContext = static_cast<QCocoaGLContext*>(context.handle());
+ if (cocoaContext->isSoftwareContext()) {
+ qWarning() << "Detected software OpenGL backend,"
+ << "which is known to be broken on"
+ << qUtf8Printable(QSysInfo::prettyProductName());
+ return true;
+ } else {
+ return false;
+ }
+ }();
+ return !isSoftwareContext;
+ }
+ Q_FALLTHROUGH();
case BufferQueueingOpenGL:
#endif
case ThreadedPixmaps: