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: Kati Kankaanpaa <kati.kankaanpaa@theqtcompany.com> Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>bb10
parent
c86ca601ed
commit
3f531512e8
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue