From cafd54d34b0e4e0fb9d99650c7c6ffd1969811a1 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 19 Mar 2015 14:49:54 +0100 Subject: Use glFinish() in QOpenGLWidget unless glFlush() is known to be enough The driver used on the Odroid-XU3 does not like doing just glFlush() before accessing the texture in another context. There is no guarantee that glFlush() is enough to sync access to resources between contexts, so start using glFinish() as the default, except on common desktop hw + iOS where flush is enough and presumably more efficient. To unify the code pathes, remove the separate flushes and do it only once, before the backingstore compositor indicates that it is about to access the textures. This should improve performance a bit, esp. when doing multisampling since we flush only once then. A helper function is added to the internal QOpenGLExtensions because it is highly likely that QQuickWidget will need the same. Task-number: QTBUG-45106 Change-Id: Ifb405c5723f29f2f6c04df8e15fb70280681755e Reviewed-by: Giuseppe D'Angelo --- src/widgets/kernel/qopenglwidget.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 3b33894627..8faa9f8681 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -691,7 +691,7 @@ void QOpenGLWidgetPrivate::beginCompose() if (flushPending) { flushPending = false; q->makeCurrent(); - context->functions()->glFlush(); + static_cast(context->functions())->flushShared(); } hasBeenComposed = true; emit q->aboutToCompose(); @@ -768,7 +768,7 @@ void QOpenGLWidgetPrivate::resolveSamples() q->makeCurrent(); QRect rect(QPoint(0, 0), fbo->size()); QOpenGLFramebufferObject::blitFramebuffer(resolvedFbo, rect, fbo, rect); - QOpenGLContext::currentContext()->functions()->glFlush(); + flushPending = true; } } @@ -779,7 +779,7 @@ void QOpenGLWidgetPrivate::invokeUserPaint() f->glViewport(0, 0, q->width() * q->devicePixelRatio(), q->height() * q->devicePixelRatio()); q->paintGL(); - f->glFlush(); + flushPending = true; } void QOpenGLWidgetPrivate::render() -- cgit v1.2.3