diff options
author | Andrew Knight <andrew.knight@digia.com> | 2013-11-20 16:56:07 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-24 21:32:03 +0100 |
commit | 7b6253efbf28b43c8b2a561c188670466ac3d916 (patch) | |
tree | e464584fa8f44ae68cb3d00250d7c137507c12de /src/platformsupport | |
parent | 06ff9c9ec0e75eca2f06c177f16c52e42f41befd (diff) |
EGL convenience: deal with DefaultRenderableType when appropriate
When encountering QSurfaceFormat::DefaultRenderableType, the surface
format choosers should not default to OpenGL ES, but rather desktop
OpenGL when Qt has been configured without ES2 support.
Change-Id: I57aa7cfe63ebe0ffb32f4ba32808e62b0a4589f8
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r-- | src/platformsupport/eglconvenience/qeglconvenience.cpp | 29 | ||||
-rw-r--r-- | src/platformsupport/eglconvenience/qeglplatformcontext.cpp | 15 |
2 files changed, 34 insertions, 10 deletions
diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index b711a2aebd..32f553a3f5 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -232,17 +232,28 @@ EGLConfig QEglConfigChooser::chooseConfig() configureAttributes.append(surfaceType()); configureAttributes.append(EGL_RENDERABLE_TYPE); - if (m_format.renderableType() == QSurfaceFormat::OpenVG) + switch (m_format.renderableType()) { + case QSurfaceFormat::OpenVG: configureAttributes.append(EGL_OPENVG_BIT); + break; #ifdef EGL_VERSION_1_4 - else if (m_format.renderableType() == QSurfaceFormat::OpenGL) +# if !defined(QT_OPENGL_ES_2) + case QSurfaceFormat::DefaultRenderableType: +# endif + case QSurfaceFormat::OpenGL: configureAttributes.append(EGL_OPENGL_BIT); + break; #endif - else if (m_format.majorVersion() == 1) - configureAttributes.append(EGL_OPENGL_ES_BIT); - else + case QSurfaceFormat::OpenGLES: + if (m_format.majorVersion() == 1) { + configureAttributes.append(EGL_OPENGL_ES_BIT); + break; + } + // fall through + default: configureAttributes.append(EGL_OPENGL_ES2_BIT); - + break; + } configureAttributes.append(EGL_NONE); EGLConfig cfg = 0; @@ -336,7 +347,11 @@ QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, if (referenceFormat.renderableType() == QSurfaceFormat::OpenVG && (renderableType & EGL_OPENVG_BIT)) format.setRenderableType(QSurfaceFormat::OpenVG); #ifdef EGL_VERSION_1_4 - else if (referenceFormat.renderableType() == QSurfaceFormat::OpenGL && (renderableType & EGL_OPENGL_BIT)) + else if ((referenceFormat.renderableType() == QSurfaceFormat::OpenGL +# if !defined(QT_OPENGL_ES_2) + || referenceFormat.renderableType() == QSurfaceFormat::DefaultRenderableType +# endif + ) && (renderableType & EGL_OPENGL_BIT)) format.setRenderableType(QSurfaceFormat::OpenGL); #endif else diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 34ba21afdc..714ad8a17e 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -49,14 +49,23 @@ static inline void bindApi(const QSurfaceFormat &format) { - if (format.renderableType() == QSurfaceFormat::OpenVG) + switch (format.renderableType()) { + case QSurfaceFormat::OpenVG: eglBindAPI(EGL_OPENVG_API); + break; #ifdef EGL_VERSION_1_4 - else if (format.renderableType() == QSurfaceFormat::OpenGL) +# if !defined(QT_OPENGL_ES_2) + case QSurfaceFormat::DefaultRenderableType: +# endif + case QSurfaceFormat::OpenGL: eglBindAPI(EGL_OPENGL_API); + break; #endif - else + case QSurfaceFormat::OpenGLES: + default: eglBindAPI(EGL_OPENGL_ES_API); + break; + } } QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, |