diff options
author | Gunnar Sletta <[email protected]> | 2014-09-30 11:26:45 +0200 |
---|---|---|
committer | Gunnar Sletta <[email protected]> | 2014-10-16 13:58:08 +0200 |
commit | 0ce63c97e6deee95c276214eb45b40244de82c7e (patch) | |
tree | 5651e0e811c74eeb935d050bf43caa3ba3beaa1e /src/quick/scenegraph/qsgthreadedrenderloop.cpp | |
parent | 4a83ef27d54d40d4224d8cee063447c9b1f7488a (diff) |
Introduced QQuickCustomRenderStage.
The purpose of this concept is to make it possible to plug in an
external rendering stage, like replacing the GL rendering with a
composition step performed by a hardware compositor in QtCompositor.
Change-Id: I994b93af443f68a77ca73cf310b5910c49e014c3
Reviewed-by: Laszlo Agocs <[email protected]>
Diffstat (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 3e0230fe02..5ed42d5e1d 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -534,16 +534,19 @@ void QSGRenderThread::syncAndRender() qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "syncAndRender()"; syncResultedInChanges = false; + QQuickWindowPrivate *d = QQuickWindowPrivate::get(window); - uint pending = pendingUpdate; + bool repaintRequested = (pendingUpdate & RepaintRequest) || d->customRenderStage; + bool syncRequested = pendingUpdate & SyncRequest; + bool exposeRequested = (pendingUpdate & ExposeRequest) == ExposeRequest; pendingUpdate = 0; - if (pending & SyncRequest) { + if (syncRequested) { qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- updatePending, doing sync"; - sync(pending == ExposeRequest); + sync(exposeRequested); } - if (!syncResultedInChanges && ((pending & RepaintRequest) == 0)) { + if (!syncResultedInChanges && !repaintRequested) { qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- no changes, render aborted"; int waitTime = vsyncDelta - (int) waitTimer.elapsed(); if (waitTime > 0) @@ -557,7 +560,6 @@ void QSGRenderThread::syncAndRender() qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- rendering started"; - QQuickWindowPrivate *d = QQuickWindowPrivate::get(window); if (animatorDriver->isRunning()) { d->animationController->lock(); @@ -573,7 +575,8 @@ void QSGRenderThread::syncAndRender() if (profileFrames) renderTime = threadTimer.nsecsElapsed(); Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame); - gl->swapBuffers(window); + if (!d->customRenderStage || !d->customRenderStage->swap()) + gl->swapBuffers(window); d->fireFrameSwapped(); } else { Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame, 1); @@ -587,7 +590,7 @@ void QSGRenderThread::syncAndRender() // that to avoid blocking the GUI thread in the case where it // has started rendering with a bad window, causing makeCurrent to // fail or if the window has a bad size. - if (pending == ExposeRequest) { + if (exposeRequested) { qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- wake Gui after initial expose"; waitCondition.wakeOne(); mutex.unlock(); |