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 <gunnar@sletta.org>
bb10
Laszlo Agocs 2015-01-31 13:54:30 +01:00
parent d800180f82
commit aa475a30af
2 changed files with 17 additions and 0 deletions

View File

@ -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
*/

View File

@ -198,6 +198,8 @@ public:
bool isOpenGLES() const;
static bool supportsThreadedOpenGL();
Q_SIGNALS:
void aboutToBeDestroyed();