Fix QEGLPbuffer::isValid() with surfaceless contexts

Task-number: QTBUG-65125
Change-Id: Idcd87804ab63031e48ff2f72eb98c986bfa39f25
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2017-12-12 13:23:38 +01:00
parent 4a4efd5693
commit 6a5ca7240a
2 changed files with 10 additions and 4 deletions

View File

@ -62,7 +62,7 @@ QEGLPbuffer::QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffs
, m_display(display)
, m_pbuffer(EGL_NO_SURFACE)
{
bool hasSurfaceless = !flags.testFlag(QEGLPlatformContext::NoSurfaceless)
m_hasSurfaceless = !flags.testFlag(QEGLPlatformContext::NoSurfaceless)
&& q_hasEglExtension(display, "EGL_KHR_surfaceless_context");
// Disable surfaceless contexts on Mesa for now. As of 10.6.0 and Intel at least, some
@ -72,9 +72,9 @@ QEGLPbuffer::QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffs
// 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;
m_hasSurfaceless = false;
if (hasSurfaceless)
if (m_hasSurfaceless)
return;
EGLConfig config = q_configFromGLFormat(m_display, m_format, false, EGL_PBUFFER_BIT);
@ -100,4 +100,9 @@ QEGLPbuffer::~QEGLPbuffer()
eglDestroySurface(m_display, m_pbuffer);
}
bool QEGLPbuffer::isValid() const
{
return m_pbuffer != EGL_NO_SURFACE || m_hasSurfaceless;
}
QT_END_NAMESPACE

View File

@ -64,7 +64,7 @@ public:
~QEGLPbuffer();
QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; }
bool isValid() const Q_DECL_OVERRIDE { return m_pbuffer != EGL_NO_SURFACE; }
bool isValid() const Q_DECL_OVERRIDE;
EGLSurface pbuffer() const { return m_pbuffer; }
@ -72,6 +72,7 @@ private:
QSurfaceFormat m_format;
EGLDisplay m_display;
EGLSurface m_pbuffer;
bool m_hasSurfaceless;
};
QT_END_NAMESPACE