diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-03-07 16:05:13 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-10 21:04:37 +0100 |
commit | 08b9e51c47ecdf6c687b3aed8bee7d7711219d25 (patch) | |
tree | c08e2aa8ea8e07df188b48e7390891cc70a67c96 /src/platformsupport/eglconvenience/qeglconvenience.cpp | |
parent | a4f421d4311e5c0d3ebf9154856d5ecb56af292e (diff) |
egl: Choose GLES3 capable configs when needed
Passing OpenGLES and majorVersion 3 in a QSurfaceFormat selects GLES3 in case
it is supported. This works fine already now, but is not safe since the config
choosing logic does not request a GLES3-capable configuration and so it may
end up with a non-GLES3 compatible one.
This is now corrected by passing the EGL_OPENGL_ES3_BIT_KHR bit when
EGL_KHR_create_context is available.
Change-Id: Iacee1e1819b944c0f7c1062666106abddf59272b
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/platformsupport/eglconvenience/qeglconvenience.cpp')
-rw-r--r-- | src/platformsupport/eglconvenience/qeglconvenience.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index 790467150f..7cf1f88b02 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -50,6 +50,10 @@ #include "qeglconvenience_p.h" +#ifndef EGL_OPENGL_ES3_BIT_KHR +#define EGL_OPENGL_ES3_BIT_KHR 0x0040 +#endif + QT_BEGIN_NAMESPACE QVector<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format) @@ -239,6 +243,7 @@ EGLConfig QEglConfigChooser::chooseConfig() configureAttributes.append(surfaceType()); configureAttributes.append(EGL_RENDERABLE_TYPE); + bool needsES2Plus = false; switch (m_format.renderableType()) { case QSurfaceFormat::OpenVG: configureAttributes.append(EGL_OPENVG_BIT); @@ -250,7 +255,7 @@ EGLConfig QEglConfigChooser::chooseConfig() configureAttributes.append(EGL_OPENGL_BIT); else #endif // QT_NO_OPENGL - configureAttributes.append(EGL_OPENGL_ES2_BIT); + needsES2Plus = true; break; case QSurfaceFormat::OpenGL: configureAttributes.append(EGL_OPENGL_BIT); @@ -263,9 +268,15 @@ EGLConfig QEglConfigChooser::chooseConfig() } // fall through default: - configureAttributes.append(EGL_OPENGL_ES2_BIT); + needsES2Plus = true; break; } + if (needsES2Plus) { + if (m_format.majorVersion() >= 3 && q_hasEglExtension(display(), "EGL_KHR_create_context")) + configureAttributes.append(EGL_OPENGL_ES3_BIT_KHR); + else + configureAttributes.append(EGL_OPENGL_ES2_BIT); + } configureAttributes.append(EGL_NONE); EGLConfig cfg = 0; |