From aa475a30af2e6905acee5e0e4260414ac493b0e3 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 31 Jan 2015 13:54:30 +0100 Subject: Expose the ThreadedOpenGL cap to apps Applications have no public API to check for the ThreadedOpenGL flag reported by the platform plugins. Add a static function to QOpenGLContext to give interested applications a way to decide if they should do rendering on separate threads. Task-number: QTBUG-44208 Change-Id: I629332512ab31fe49f842065a911270cd6cea7aa Reviewed-by: Gunnar Sletta --- src/gui/kernel/qopenglcontext.cpp | 15 +++++++++++++++ src/gui/kernel/qopenglcontext.h | 2 ++ 2 files changed, 17 insertions(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 90e9235353..8cfb4154c1 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1184,6 +1184,21 @@ bool QOpenGLContext::isOpenGLES() const return format().renderableType() == QSurfaceFormat::OpenGLES; } +/*! + Returns \c true if the platform supports OpenGL rendering outside the main (gui) + thread. + + The value is controlled by the platform plugin in use and may also depend on the + graphics drivers. + + \since 5.5 + */ +bool QOpenGLContext::supportsThreadedOpenGL() +{ + Q_ASSERT(qGuiApp); + return QGuiApplicationPrivate::instance()->platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL); +} + /*! \internal */ diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index b31cc693b7..6be82aeb1d 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -198,6 +198,8 @@ public: bool isOpenGLES() const; + static bool supportsThreadedOpenGL(); + Q_SIGNALS: void aboutToBeDestroyed(); -- cgit v1.2.3