summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-06-22 10:58:12 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-06-22 21:15:31 +0000
commit8aaf8d33e1a22778b8a0d6063cee1a7915326838 (patch)
tree7bccab589da67937706a7519fe94250d8f1a1511 /src/platformsupport
parentf0fecf7b61433595ee53de7685f6a4c47bbed6e1 (diff)
Disable surfaceless QOffscreenSurface with Mesa
With Intel at least Mesa is unable to handle surfaceless contexts in glReadPixels(). This cripples QOpenGLFramebufferObject::toImage() and potentially others too. Task-number: QTBUG-46605 Change-Id: I07c1015eca67b8add14496ec0df0e0c17ac3d896 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/eglconvenience/qeglpbuffer.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/platformsupport/eglconvenience/qeglpbuffer.cpp b/src/platformsupport/eglconvenience/qeglpbuffer.cpp
index 9cdf5a0931..756609a641 100644
--- a/src/platformsupport/eglconvenience/qeglpbuffer.cpp
+++ b/src/platformsupport/eglconvenience/qeglpbuffer.cpp
@@ -55,7 +55,18 @@ QEGLPbuffer::QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffs
, m_display(display)
, m_pbuffer(EGL_NO_SURFACE)
{
- if (q_hasEglExtension(display, "EGL_KHR_surfaceless_context"))
+ bool hasSurfaceless = q_hasEglExtension(display, "EGL_KHR_surfaceless_context");
+
+ // Disable surfaceless contexts on Mesa for now. As of 10.6.0 and Intel at least, some
+ // operations (glReadPixels) are unable to work without a surface since they at some
+ // point temporarily unbind the current FBO and then later blow up in some seemingly
+ // safe operations, like setting the viewport, that apparently need access to the
+ // read/draw surface in the Intel backend.
+ const char *vendor = eglQueryString(display, EGL_VENDOR); // hard to check for GL_ strings here, so blacklist all Mesa
+ if (vendor && strstr(vendor, "Mesa"))
+ hasSurfaceless = false;
+
+ if (hasSurfaceless)
return;
EGLConfig config = q_configFromGLFormat(m_display, m_format, false, EGL_PBUFFER_BIT);