iOS: Enable threaded OpenGL.

This change activates ThreadedOpenGL and ThreadedPixmaps capabilities
in the iOS integration. QIOSContext is expanded with a support for
a shared context.

Change-Id: I56615c870a24e17850ad2748421c54e015de3ab2
Reviewed-by: Ian Dean <ian@mediator-software.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
Maciej Kujalowicz 2013-10-30 13:01:21 +01:00 committed by The Qt Project
parent aa6a0cdbf5
commit 450d3efcb1
3 changed files with 21 additions and 1 deletions

View File

@ -66,10 +66,14 @@ public:
GLuint defaultFramebufferObject(QPlatformSurface *) const;
QFunctionPointer getProcAddress(const QByteArray &procName);
bool isSharing() const Q_DECL_OVERRIDE;
bool isValid() const Q_DECL_OVERRIDE;
private Q_SLOTS:
void windowDestroyed(QObject *object);
private:
QIOSContext *m_sharedContext;
EAGLContext *m_eaglContext;
QSurfaceFormat m_format;

View File

@ -51,7 +51,10 @@
QIOSContext::QIOSContext(QOpenGLContext *context)
: QPlatformOpenGLContext()
, m_eaglContext([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2])
, m_sharedContext(static_cast<QIOSContext *>(context->shareHandle()))
, m_eaglContext([[EAGLContext alloc]
initWithAPI:kEAGLRenderingAPIOpenGLES2
sharegroup:m_sharedContext ? [m_sharedContext->m_eaglContext sharegroup] : nil])
, m_format(context->format())
{
m_format.setRenderableType(QSurfaceFormat::OpenGLES);
@ -203,5 +206,15 @@ QFunctionPointer QIOSContext::getProcAddress(const QByteArray& functionName)
return QFunctionPointer(dlsym(RTLD_DEFAULT, functionName.constData()));
}
bool QIOSContext::isValid() const
{
return m_eaglContext;
}
bool QIOSContext::isSharing() const
{
return m_sharedContext;
}
#include "moc_qioscontext.cpp"

View File

@ -102,6 +102,9 @@ bool QIOSIntegration::hasCapability(Capability cap) const
{
switch (cap) {
case OpenGL:
case ThreadedOpenGL:
return true;
case ThreadedPixmaps:
return true;
case MultipleWindows:
return true;