diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-01-29 17:59:44 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-02-02 14:03:24 +0000 |
commit | d800180f828087e144b30346e8cea312aa2bf062 (patch) | |
tree | ecd87dedac480374ca17ac42e965f54934b22c90 /src/gui/kernel/qoffscreensurface.cpp | |
parent | 5382312e5c93c91be7e74e688331db0feeb438e7 (diff) |
Utilize EGL_KHR_surfaceless_context in QOffscreenSurface when available
Use it also in the context initialization code which also relied on pbuffers
until now.
This is safe to do since QOffscreenSurface is deliberately kept minimal: we only
support it for rendering to FBOs or uploading textures, it is quite useless for
any rendering type of operation. Therefore simply not creating a surface when
the extension is available is viable and should not break anything.
While we should have done this a long time ago, the real inspiration now is
to avoid crashes with some bad EGL implementations.
Mesa in particular tends to crash in its interal configuration handling when
trying to create a pbuffer surface with more exotic attributes, for example with
multisampling enabled. Just getting rid of those properties is not an option
since the resulting pbuffer would not be compatible with the existing context.
Therefore our only option is to avoid the pbuffer altogether.
There's a so-far-ignored patch for Mesa http://patchwork.freedesktop.org/patch/38100/
which tries to solve some of this but it turns out it is not sufficient to avoid problems
with the multisampled case. So to avoid more headache, we just stop using pbuffers
there.
[ChangeLog][QtGui] QOffscreenSurface is now relying on EGL_KHR_surfaceless_context when
available, and avoids creating a pbuffer surface when the extension is present.
Change-Id: Id18742768b8e66c8d92ce65a9bf64b0296e14db7
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/gui/kernel/qoffscreensurface.cpp')
-rw-r--r-- | src/gui/kernel/qoffscreensurface.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp index fb1dfd8df5..ed1b8d944a 100644 --- a/src/gui/kernel/qoffscreensurface.cpp +++ b/src/gui/kernel/qoffscreensurface.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QOffscreenSurface is intended to be used with QOpenGLContext to allow rendering with OpenGL in an arbitrary thread without the need to create a QWindow. - Even though the surface is renderable, the surface's pixels are not accessible. + Even though the surface is typically renderable, the surface's pixels are not accessible. QOffscreenSurface should only be used to create OpenGL resources such as textures or framebuffer objects. @@ -77,6 +77,11 @@ QT_BEGIN_NAMESPACE created}. Passing the format returned from QWindow::requestedFormat() to setFormat() may result in an incompatible offscreen surface since the underlying windowing system interface may offer a different set of configurations for window and pbuffer surfaces. + + \note Some platforms may utilize a surfaceless context extension (for example + EGL_KHR_surfaceless_context) when available. In this case there will be no underlying + native surface. For the use cases of QOffscreenSurface (rendering to FBOs, texture + upload) this is not a problem. */ class Q_GUI_EXPORT QOffscreenSurfacePrivate : public QObjectPrivate { |