diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-22 19:05:40 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-22 19:05:40 (GMT) |
commit | f20b9460e1e67a0ddd7e4e69224722d5b8c3f5c9 (patch) | |
tree | 55ba2b6e3647d83b6fac79c01fd2e3061e53f76e /src/opengl | |
parent | 99d33dbaade6417ef1697bdfb82fdd1ec8e659c0 (diff) | |
parent | 2cd7c88e437a221bd7bf935352cf24820ed08928 (diff) | |
download | Qt-f20b9460e1e67a0ddd7e4e69224722d5b8c3f5c9.zip Qt-f20b9460e1e67a0ddd7e4e69224722d5b8c3f5c9.tar.gz Qt-f20b9460e1e67a0ddd7e4e69224722d5b8c3f5c9.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging:
Optimized glyph uploads in GL texture cache.
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 15 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 3 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 3 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 4362c0a..9e8e828 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -339,8 +339,19 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed sub // by converting it to a format with four bytes per pixel. Another is to copy one line at a // time. - for (int i = 0; i < maskHeight; ++i) - glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i)); + if (!ctx->d_ptr->workaround_brokenAlphaTexSubImage_init) { + // don't know which driver versions exhibit this bug, so be conservative for now + const QByteArray versionString(reinterpret_cast<const char*>(glGetString(GL_VERSION))); + ctx->d_ptr->workaround_brokenAlphaTexSubImage = versionString.indexOf("NVIDIA") >= 0; + ctx->d_ptr->workaround_brokenAlphaTexSubImage_init = true; + } + + if (ctx->d_ptr->workaround_brokenAlphaTexSubImage) { + for (int i = 0; i < maskHeight; ++i) + glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i)); + } else { + glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits()); + } } } diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 9e39389..19858e7 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1738,6 +1738,9 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) workaround_brokenTextureFromPixmap = false; workaround_brokenTextureFromPixmap_init = false; + workaround_brokenAlphaTexSubImage = false; + workaround_brokenAlphaTexSubImage_init = false; + for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) vertexAttributeArraysEnabledState[i] = false; } diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 5508598..5a5e5cc 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -416,6 +416,9 @@ public: uint workaround_brokenTextureFromPixmap : 1; uint workaround_brokenTextureFromPixmap_init : 1; + uint workaround_brokenAlphaTexSubImage : 1; + uint workaround_brokenAlphaTexSubImage_init : 1; + #ifndef QT_NO_EGL uint ownsEglContext : 1; #endif |