Commit 3f531512 authored by Laszlo Agocs's avatar Laszlo Agocs
Browse files

Force GLES 2.0 on Android 4.2 devices reporting 3.0


Android does not support GLES 3.0 before 4.3 (API level 18). However some
4.2.2 devices are reported to return 3.0 in the version string and therefore
choose the GLES 3+ code paths in Qt. This blows up sooner or later because
the 3.0 specific functions are apparently not present at all.

Task-number: QTBUG-46831
Change-Id: Ic3eeb7c55829cf36c6d142c01ff8a1e18e9ecc1a
Reviewed-by: default avatarKati Kankaanpaa <kati.kankaanpaa@theqtcompany.com>
Reviewed-by: default avatarChristian Stromme <christian.stromme@theqtcompany.com>
Showing with 12 additions and 0 deletions
......@@ -39,6 +39,10 @@
#include <QtPlatformHeaders/QEGLNativeContext>
#include <QDebug>
#ifdef Q_OS_ANDROID
#include <QtCore/private/qjnihelpers_p.h>
#endif
QT_BEGIN_NAMESPACE
/*!
......@@ -294,6 +298,14 @@ void QEGLPlatformContext::updateFormatFromGL()
QByteArray version = QByteArray(reinterpret_cast<const char *>(s));
int major, minor;
if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) {
#ifdef Q_OS_ANDROID
// Some Android 4.2.2 devices report OpenGL ES 3.0 without the functions being available.
static int apiLevel = QtAndroidPrivate::androidSdkVersion();
if (apiLevel <= 17 && major >= 3) {
major = 2;
minor = 0;
}
#endif
m_format.setMajorVersion(major);
m_format.setMinorVersion(minor);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment