diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> | 2013-07-29 13:49:42 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-29 17:58:30 +0200 |
commit | 9eeb1bd4d44b71c4251090e9f3b7427a493d873d (patch) | |
tree | 6590bf1207886dab99f08f2472e4f3e1304425bf /src/plugins | |
parent | 32e6778bda06f348796df60dce7c2d40f3d97452 (diff) |
Add workaround for GL on Android emulator
On the Android Emulator, the shaders will be compiled by a desktop
GL driver, since the GL driver in the emulator is just a thin
wrapper. The GL driver does not necessarily support the precision
qualifiers, which can cause applications to break. We detect this
at runtime in the platform plugin and set a workaround flag to
Task-number: QTBUG-32557
Change-Id: Ied00cfe8e804d1f7862697dd379a14f3bed3d980
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp | 15 | ||||
-rw-r--r-- | src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp index 4d741807d0..9d6d4003f7 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp @@ -46,6 +46,8 @@ #include <QtCore/qdebug.h> #include <qpa/qwindowsysteminterface.h> +#include <QtGui/private/qopenglcontext_p.h> + QT_BEGIN_NAMESPACE QAndroidOpenGLContext::QAndroidOpenGLContext(const QAndroidPlatformIntegration *integration, @@ -75,4 +77,17 @@ void QAndroidOpenGLContext::swapBuffers(QPlatformSurface *surface) } } +bool QAndroidOpenGLContext::makeCurrent(QPlatformSurface *surface) +{ + bool ret = QEglFSContext::makeCurrent(surface); + + const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER)); + if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0) { + QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context()); + ctx_d->workaround_missingPrecisionQualifiers = true; + } + + return ret; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h index c4c5a430ad..c419ae8392 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h @@ -58,6 +58,7 @@ public: EGLenum eglApi = EGL_OPENGL_ES_API); void swapBuffers(QPlatformSurface *surface); + bool makeCurrent(QPlatformSurface *surface); private: const QAndroidPlatformIntegration *m_platformIntegration; |