aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-01-13 11:56:59 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-17 13:04:09 +0100
commited7115ffde52c57a308199c3d279ea3c96668117 (patch)
treeaf8e8d9f8849c5c40d628a68b51969f562b10e01 /src/quick
parentda54d7f1a6f44a32c062094baf9ed1cb7156348d (diff)
Work around missing BGRA texture format on Samsung Galaxy Tab 3
The GL driver on the Galaxy Tab 3 reports support for the BGRA8888 texture format, but does not actually support it. For this particular device we disable support for that format. Task-number: QTBUG-34984 Change-Id: Ie26ef0e815c1622b3425c37237a3fc320543b92c Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp18
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp17
2 files changed, 30 insertions, 5 deletions
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 389945849f..378451c307 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -48,6 +48,7 @@
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
#include <QtGui/QSurface>
+#include <QtGui/qpa/qplatformnativeinterface.h>
#include <private/qsgtexture_p.h>
@@ -144,10 +145,21 @@ Atlas::Atlas(const QSize &size)
{
#ifdef QT_OPENGL_ES
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString *deviceName =
+ static_cast<QString *>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("AndroidDeviceName"));
+ static bool wrongfullyReportsBgra8888Support = deviceName->compare(QStringLiteral("samsung SM-T211"), Qt::CaseInsensitive) == 0
+ || deviceName->compare(QStringLiteral("samsung SM-T210"), Qt::CaseInsensitive) == 0
+ || deviceName->compare(QStringLiteral("samsung SM-T215"), Qt::CaseInsensitive) == 0;
+#else
+ static bool wrongfullyReportsBgra8888Support = false;
+#endif
+
const char *ext = (const char *) glGetString(GL_EXTENSIONS);
- if (strstr(ext, "GL_EXT_bgra")
- || strstr(ext, "GL_EXT_texture_format_BGRA8888")
- || strstr(ext, "GL_IMG_texture_format_BGRA8888")) {
+ if (!wrongfullyReportsBgra8888Support
+ && (strstr(ext, "GL_EXT_bgra")
+ || strstr(ext, "GL_EXT_texture_format_BGRA8888")
+ || strstr(ext, "GL_IMG_texture_format_BGRA8888"))) {
m_internalFormat = m_externalFormat = GL_BGRA;
#ifdef Q_OS_IOS
} else if (strstr(ext, "GL_APPLE_texture_format_BGRA8888")) {
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index df724d8a01..04ffad7acf 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -47,6 +47,8 @@
#include <qthread.h>
#include <private/qqmlprofilerservice_p.h>
#include <private/qqmlglobal_p.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qpa/qplatformnativeinterface.h>
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
#define CAN_BACKTRACE_EXECINFO
@@ -682,14 +684,25 @@ void QSGPlainTexture::bind()
GLenum externalFormat = GL_RGBA;
GLenum internalFormat = GL_RGBA;
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString *deviceName =
+ static_cast<QString *>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("AndroidDeviceName"));
+ static bool wrongfullyReportsBgra8888Support = deviceName->compare(QStringLiteral("samsung SM-T211"), Qt::CaseInsensitive) == 0
+ || deviceName->compare(QStringLiteral("samsung SM-T210"), Qt::CaseInsensitive) == 0
+ || deviceName->compare(QStringLiteral("samsung SM-T215"), Qt::CaseInsensitive) == 0;
+#else
+ static bool wrongfullyReportsBgra8888Support = false;
+#endif
+
QOpenGLContext *context = QOpenGLContext::currentContext();
if (context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"))) {
externalFormat = GL_BGRA;
#ifdef QT_OPENGL_ES
internalFormat = GL_BGRA;
#endif
- } else if (context->hasExtension(QByteArrayLiteral("GL_EXT_texture_format_BGRA8888"))
- || context->hasExtension(QByteArrayLiteral("GL_IMG_texture_format_BGRA8888"))) {
+ } else if (!wrongfullyReportsBgra8888Support
+ && (context->hasExtension(QByteArrayLiteral("GL_EXT_texture_format_BGRA8888"))
+ || context->hasExtension(QByteArrayLiteral("GL_IMG_texture_format_BGRA8888")))) {
externalFormat = GL_BGRA;
internalFormat = GL_BGRA;
#ifdef Q_OS_IOS