summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl.cpp
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond.kjernasen@nokia.com>2010-09-27 10:14:56 (GMT)
committerTrond Kjernåsen <trond.kjernasen@nokia.com>2010-09-27 10:21:14 (GMT)
commit5ff714badf06f492c3f6f8282b64181cc93faadb (patch)
tree0b7273a962ef7c0ccbcfe778def46d20e4913f13 /src/opengl/qgl.cpp
parent52e36c493d579323a09957028b0fd5ebc4d43021 (diff)
downloadQt-5ff714badf06f492c3f6f8282b64181cc93faadb.zip
Qt-5ff714badf06f492c3f6f8282b64181cc93faadb.tar.gz
Qt-5ff714badf06f492c3f6f8282b64181cc93faadb.tar.bz2
Don't disable texture_from_pixmap on GLX/X11 by default.
We made a mistake of trying to make use of the texture_from_pixmap extension by default when binding textures in Qt. The extension have several limitation and using it produces crashes with certain drivers/graphic card combos, but we can't change this now since it will break existing apps using well behaved drivers. We'll fix this for 4.8 with either a QGL::BindOption or configure flag. Revert "Don't try to use the texture_from_pixmap extension in GL on desktop/X11." This reverts commit 07c5429d5aacab932cd912e66287d66fb952e7c4.
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r--src/opengl/qgl.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index b678790..9e74e04 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1692,6 +1692,9 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
workaround_brokenFBOReadBack = false;
workaroundsCached = false;
+ workaround_brokenTextureFromPixmap = false;
+ workaround_brokenTextureFromPixmap_init = false;
+
for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i)
vertexAttributeArraysEnabledState[i] = false;
}
@@ -2577,18 +2580,34 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target,
}
}
-#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
- // Only try to use texture_from_pixmap under X11/EGL
+#if defined(Q_WS_X11)
+ // Try to use texture_from_pixmap
const QX11Info *xinfo = qt_x11Info(paintDevice);
if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType
&& xinfo && xinfo->screen() == pixmap.x11Info().screen()
&& target == GL_TEXTURE_2D)
{
- texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options);
- if (texture) {
- texture->options |= QGLContext::MemoryManagedBindOption;
- texture->boundPixmap = pd;
- boundPixmaps.insert(pd, QPixmap(pixmap));
+ if (!workaround_brokenTextureFromPixmap_init) {
+ workaround_brokenTextureFromPixmap_init = true;
+
+ const QByteArray versionString(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
+ const int pos = versionString.indexOf("NVIDIA ");
+
+ if (pos >= 0) {
+ const QByteArray nvidiaVersionString = versionString.mid(pos + strlen("NVIDIA "));
+
+ if (nvidiaVersionString.startsWith("195") || nvidiaVersionString.startsWith("256"))
+ workaround_brokenTextureFromPixmap = true;
+ }
+ }
+
+ if (!workaround_brokenTextureFromPixmap) {
+ texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options);
+ if (texture) {
+ texture->options |= QGLContext::MemoryManagedBindOption;
+ texture->boundPixmap = pd;
+ boundPixmaps.insert(pd, QPixmap(pixmap));
+ }
}
}
#endif