summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaglcontext.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-07-31 14:59:37 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-10-03 13:04:41 +0000
commit01ade488ddf6dc667f38173ba3b2330224761f45 (patch)
tree51fd7f0eac2d633ece35e98df3b43fe11e377336 /src/plugins/platforms/cocoa/qcocoaglcontext.h
parenta154ea89e8ae4113f2dd63eb96864c9182f2c459 (diff)
macOS: Don't call [NSOpenGLContext update] for every frame
Calling update has a cost, and should only be done when the drawable object changes size or location. Instead of calling update each time makeCurrent is called, we listen for the appropriate notifications, limiting the number of update calls significantly. We still call update on the thread owning the QOpenGLContext, which is not ideal, as [NSOpenGLContext update] should only be called on the main thread, but in practice this works. Getting out of this situation is tricky, and setView has in theory the same problems. Until those problems have been solved we keep the behavior as is. Task-number: QTBUG-63572 Change-Id: Ibac9f8be7843f2aa006af6f7ee670bf027122440 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaglcontext.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h
index cef5892989..eefb1cd0fb 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h
@@ -41,6 +41,7 @@
#define QCOCOAGLCONTEXT_H
#include <QtCore/QPointer>
+#include <QtCore/private/qcore_mac_p.h>
#include <qpa/qplatformopenglcontext.h>
#include <QtGui/QOpenGLContext>
#include <QtGui/QWindow>
@@ -79,6 +80,8 @@ private:
NSOpenGLContext *m_shareContext = nil;
QSurfaceFormat m_format;
bool m_didCheckForSoftwareContext = false;
+ QVarLengthArray<QMacScopedObserver, 3> m_updateObservers;
+ QAtomicInt m_needsUpdate = false;
};
QT_END_NAMESPACE