summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-05-12 18:11:25 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-13 14:38:05 +0200
commit2406a8b45f2ba25ab250d36f520dd903b88189f2 (patch)
treed1ede4612f0d2f2bd3bf7c3347abab7ec1a3b920
parent12ba0d2cb32a3e9d7397a64db60f73d3e7a14359 (diff)
Remove an unused workaround and fix up the comments in the glyph cache
This old workaround is not necessary and could not be used anyhow since it would affect a way too wide range of drivers. Modern drivers should be able to honor the default GL_UNPACK_ALIGNMENT of 4 even for 1 byte per pixel formats like GL_ALPHA. Instead, document why the behavior is correct. Change-Id: I1687448ba92875c8ff772ccc371894e88ff64096 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp31
1 files changed, 2 insertions, 29 deletions
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index ac88d9d3a5..f721d5cb8c 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -408,41 +408,14 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
#endif
funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, fmt, GL_UNSIGNED_BYTE, mask.bits());
} else {
- // glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is
- // not a multiple of four bytes. The bug appeared on a computer with 32-bit Windows Vista
- // and nVidia GeForce 8500GT. GL_UNPACK_ALIGNMENT is set to four bytes, 'mask' has a
- // multiple of four bytes per line, and most of the glyph shows up correctly in the
- // texture, which makes me think that this is a driver bug.
- // One workaround is to make sure the mask width is a multiple of four bytes, for instance
- // by converting it to a format with four bytes per pixel. Another is to copy one line at a
- // time.
-
-#if 0
- if (!ctx->d_func()->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)));
- glctx->d_func()->workaround_brokenAlphaTexSubImage = versionString.indexOf("NVIDIA") >= 0;
- glctx->d_func()->workaround_brokenAlphaTexSubImage_init = true;
- }
-#endif
-
-#if 0
- if (ctx->d_func()->workaround_brokenAlphaTexSubImage) {
- for (int i = 0; i < maskHeight; ++i)
- funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i));
- } else {
-#endif
-
+ // The scanlines in mask are 32-bit aligned, even for mono or 8-bit formats. This
+ // is good because it matches the default of 4 bytes for GL_UNPACK_ALIGNMENT.
#if !defined(QT_OPENGL_ES_2)
const GLenum format = isCoreProfile() ? GL_RED : GL_ALPHA;
#else
const GLenum format = GL_ALPHA;
#endif
funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, format, GL_UNSIGNED_BYTE, mask.bits());
-
-#if 0
- }
-#endif
}
}