summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2010-04-16 16:20:37 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2010-04-19 08:30:07 (GMT)
commit5ce428cf7f20cd37f4cf0d92ddcceddd07c5a0db (patch)
tree977ef375bc85944fe5d9f5c362e69e11f998825f /src/opengl
parent8fffbc7768be28fb2b31727bf79b2e2357ce9814 (diff)
downloadQt-5ce428cf7f20cd37f4cf0d92ddcceddd07c5a0db.zip
Qt-5ce428cf7f20cd37f4cf0d92ddcceddd07c5a0db.tar.gz
Qt-5ce428cf7f20cd37f4cf0d92ddcceddd07c5a0db.tar.bz2
QX11GL: Fix bug with pixmaps drawn on multiple top-levels
Reviewed-By: TrustMe
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qpixmapdata_x11gl_egl.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp
index 3ab385a..4d726b6 100644
--- a/src/opengl/qpixmapdata_x11gl_egl.cpp
+++ b/src/opengl/qpixmapdata_x11gl_egl.cpp
@@ -66,7 +66,8 @@ QT_BEGIN_NAMESPACE
// different contexts:
Q_GLOBAL_STATIC(QEglContext, qt_x11gl_rgbContext);
-Q_GLOBAL_STATIC(QEglContext, qt_x11gl_argbContext)
+Q_GLOBAL_STATIC(QEglContext, qt_x11gl_argbContext);
+Q_GLOBAL_STATIC_WITH_ARGS(QGLContext, qt_x11gl_fake_shared_context, (QX11GLPixmapData::glFormat()));
QEglContext* QX11GLPixmapData::rgbContext = 0;
QEglContext* QX11GLPixmapData::argbContext = 0;
@@ -112,7 +113,13 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
if (!argbContext) {
argbContext = qt_x11gl_argbContext();
argbContext->setConfig(argbConfig);
- argbContext->createContext();
+ bool success = argbContext->createContext(rgbContext);
+ if (!success) {
+ qWarning("QX11GLPixmapData - RGB & ARGB contexts aren't shared");
+ success = argbContext->createContext();
+ if (!success)
+ argbContext = rgbContext; // Might work, worth a shot at least.
+ }
}
if (!argbContext->isValid())
@@ -258,6 +265,14 @@ QPaintEngine* QX11GLPixmapData::paintEngine() const
ctx = new QGLContext(glFormat());
Q_ASSERT(ctx->d_func()->eglContext == 0);
ctx->d_func()->eglContext = hasAlphaChannel() ? argbContext : rgbContext;
+
+ // While we use a seperate QGLContext for each pixmap, the underlying QEglContext is
+ // the same. So we must use a "fake" QGLContext and fool the texture cache into thinking
+ // each pixmap's QGLContext is sharing with this central one. The only place this is
+ // going to fail is where we the underlying EGL RGB and ARGB contexts aren't sharing.
+ ctx->d_func()->sharing = true;
+ QGLContextGroup::addShare(ctx, qt_x11gl_fake_shared_context());
+
// Update the glFormat for the QGLContext:
qt_glformat_from_eglconfig(ctx->d_func()->glFormat, ctx->d_func()->eglContext->config());
}