diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2012-12-25 00:21:25 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-02-27 23:56:03 +0100 |
commit | 847ac6008ca02a9acb1f4bd2159c6e4cfa332961 (patch) | |
tree | 3f97206542a8d5a7f348e4a56669a52d265954d6 /src/plugins/platforms/ios/qioscontext.h | |
parent | 157d690b8c190f341f1fa4cb6aff4c044456e99f (diff) |
iOS: Move handling of FBOs to QIOSContext instead of QIOSWindow
The lifetime of an FBO is tied to its context, so letting each window
manage its own FBO failed when the window tried to delete the FBO
at destruction time without the proper context being current, or
even available anymore.
We solve this by moving all handling of FBOs to the context itself,
which is fine as we're exposing the necessary bits from the window
to allocate storage based on its layer.
Change-Id: I8c7c96cf63d6b667527c816f10ac2f4ff6a05e0c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qioscontext.h')
-rw-r--r-- | src/plugins/platforms/ios/qioscontext.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/plugins/platforms/ios/qioscontext.h b/src/plugins/platforms/ios/qioscontext.h index b45917832c..082ec4794c 100644 --- a/src/plugins/platforms/ios/qioscontext.h +++ b/src/plugins/platforms/ios/qioscontext.h @@ -48,8 +48,10 @@ QT_BEGIN_NAMESPACE -class QIOSContext : public QPlatformOpenGLContext +class QIOSContext : public QObject, public QPlatformOpenGLContext { + Q_OBJECT + public: QIOSContext(QOpenGLContext *context); ~QIOSContext(); @@ -62,15 +64,26 @@ public: void doneCurrent(); GLuint defaultFramebufferObject(QPlatformSurface *) const; - GLuint defaultColorRenderbuffer(QPlatformSurface *) const; - QFunctionPointer getProcAddress(const QByteArray &procName); - EAGLContext *nativeContext() const; +private Q_SLOTS: + void windowDestroyed(QObject *object); private: EAGLContext *m_eaglContext; QSurfaceFormat m_format; + + struct FramebufferObject { + GLuint handle; + GLuint colorRenderbuffer; + GLuint depthRenderbuffer; + GLint renderbufferWidth; + GLint renderbufferHeight; + }; + + static void deleteBuffers(const FramebufferObject &framebufferObject); + + mutable QHash<QWindow *, FramebufferObject> m_framebufferObjects; }; QT_END_NAMESPACE |