Skip to content

Instantly share code, notes, and snippets.

@torarnv
Created March 27, 2014 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torarnv/9810372 to your computer and use it in GitHub Desktop.
Save torarnv/9810372 to your computer and use it in GitHub Desktop.
diff --git i/src/plugins/platforms/ios/qioscontext.h w/src/plugins/platforms/ios/qioscontext.h
index 52357a5..93be4cb 100644
--- i/src/plugins/platforms/ios/qioscontext.h
+++ w/src/plugins/platforms/ios/qioscontext.h
@@ -88,7 +88,7 @@ private:
bool isComplete;
};
- static void deleteBuffers(const FramebufferObject &framebufferObject);
+ void deleteBuffers(const FramebufferObject &framebufferObject);
FramebufferObject &backingFramebufferObjectFor(QPlatformSurface *) const;
mutable QHash<QIOSWindow *, FramebufferObject> m_framebufferObjects;
diff --git i/src/plugins/platforms/ios/qioscontext.mm w/src/plugins/platforms/ios/qioscontext.mm
index 1ea0403..ddee521 100644
--- i/src/plugins/platforms/ios/qioscontext.mm
+++ w/src/plugins/platforms/ios/qioscontext.mm
@@ -140,17 +140,22 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface)
if (surface->surface()->surfaceClass() == QSurface::Offscreen)
return; // Nothing to do
- Q_ASSERT(surface->surface()->surfaceClass() == QSurface::Window);
- QIOSWindow *window = static_cast<QIOSWindow *>(surface);
- Q_ASSERT(m_framebufferObjects.contains(window));
+ FramebufferObject &framebufferObject = backingFramebufferObjectFor(surface);
[EAGLContext setCurrentContext:m_eaglContext];
- glBindRenderbuffer(GL_RENDERBUFFER, m_framebufferObjects[window].colorRenderbuffer);
+ glBindRenderbuffer(GL_RENDERBUFFER, framebufferObject.colorRenderbuffer);
[m_eaglContext presentRenderbuffer:GL_RENDERBUFFER];
}
QIOSContext::FramebufferObject &QIOSContext::backingFramebufferObjectFor(QPlatformSurface *surface) const
{
+ // We keep track of default-FBOs in the root context of a share-group. This assumes
+ // that the contexts form a tree, where leaf nodes are always destroyed before their
+ // parents. If that assumption (based on the current implementation) doesn't hold we
+ // should probably use QOpenGLMultiGroupSharedResource to track the shared default-FBOs.
+ if (m_sharedContext)
+ return m_sharedContext->backingFramebufferObjectFor(surface);
+
Q_ASSERT(surface && surface->surface()->surfaceClass() == QSurface::Window);
QIOSWindow *window = static_cast<QIOSWindow *>(surface);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment