diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index 919f7c240bc..36546879ae4 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -29,6 +29,7 @@ public: void initialize() override; bool makeCurrent(QPlatformSurface *surface) override; + void beginFrame() override; void swapBuffers(QPlatformSurface *surface) override; void doneCurrent() override; diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index a65311175ff..bfac716b633 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -332,6 +332,25 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface) return true; } +void QCocoaGLContext::beginFrame() +{ + QMacAutoReleasePool pool; + + Q_ASSERT(context() && context()->surface()); + auto *surface = context()->surface()->surfaceHandle(); + Q_ASSERT(surface); + + qCDebug(lcQpaOpenGLContext) << "Beginning frame for" << this + << "in" << QThread::currentThread() << "for" << surface; + + Q_ASSERT(surface->surface()->supportsOpenGL()); + + if (surface->surface()->surfaceClass() == QSurface::Window) { + if (m_needsUpdate.fetchAndStoreRelaxed(false)) + update(); + } +} + /*! Sets the drawable object of the NSOpenGLContext, which is the frame buffer that is the target of OpenGL drawing operations.