summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglframebufferobject.cpp
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@theqtcompany.com>2015-09-15 18:17:06 +0200
committerChristian Stromme <christian.stromme@theqtcompany.com>2015-09-18 12:07:09 +0000
commit0e647aeb6a49a0fc9b5605031f246bb79dd6a6fc (patch)
tree7696ffa84073c046d7955d87760cf5d69374cd63 /src/gui/opengl/qopenglframebufferobject.cpp
parentd4ebbac1b3c6abbdbf5a67c75460c33998847233 (diff)
Blacklist PowerVR Rogue G6200 (v1.3) from supporting BGRA.
The drivers for PowerVR Rogue G6200 reports BGRA support, but reading from the FBO does not produce the correct result. Initially reported here: http://launchpad.net/bugs/1436074 Change-Id: Ia173817d557446818d08609d943eb3573b900cc3 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/gui/opengl/qopenglframebufferobject.cpp')
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 8d298496df..1cf748d15f 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -43,6 +43,7 @@
#include <qwindow.h>
#include <qlibrary.h>
#include <qimage.h>
+#include <QtCore/qbytearray.h>
QT_BEGIN_NAMESPACE
@@ -1141,9 +1142,19 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
// Without GL_UNSIGNED_INT_8_8_8_8_REV, GL_BGRA only makes sense on little endian.
- const bool supports_bgra = context->isOpenGLES()
- ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra"))
- : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"));
+ const bool has_bgra_ext = context->isOpenGLES()
+ ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra"))
+ : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"));
+
+ const char *renderer = reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER));
+ const char *ver = reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION));
+
+ // Blacklist PowerVR Rogue G6200 as it has problems with its BGRA support.
+ const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0
+ && ::strstr(ver, "1.3") != 0);
+
+ const bool supports_bgra = has_bgra_ext && !blackListed;
+
if (supports_bgra) {
QImage img(size, include_alpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);
funcs->glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, img.bits());