summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvenn-Arne Dragly <svenn-arne.dragly@qt.io>2018-02-13 12:52:57 +0100
committerSvenn-Arne Dragly <svenn-arne.dragly@qt.io>2018-02-14 16:54:12 +0000
commitc40c7ac6b57603ecb992f666ce7435110bb3e587 (patch)
treec27e63a9fe668a1ef9ace655e0a42649a27e751b
parent9c3c479193ec1bb02732c762fd5c4501b0a7933a (diff)
Fix OnDemand rendering by keeping ComputeDirty from being re-enabled
The previous implementation would reset ComputeDirty every frame if markDirty(AllDirty) had been called earlier. This would break the OnDemand rendering policy because every frame would be rendered even if there were no changes or no compute commands in the scene. This change removes the code that would re-enable the ComputeDirty flag every frame and documents that the user must either set the rendering policy to Always or trigger the rendering of a new frame if the rendering policy is set to OnDemand. Change-Id: Ide03a3a49ee1670fd9d67ed47454c6679219765d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/render/backend/renderer.cpp6
-rw-r--r--src/render/frontend/qcomputecommand.cpp12
2 files changed, 13 insertions, 5 deletions
diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp
index 0512fbdd2..02d0edf8f 100644
--- a/src/render/backend/renderer.cpp
+++ b/src/render/backend/renderer.cpp
@@ -597,11 +597,7 @@ void Renderer::doRender(bool scene3dBlocking)
submissionStatsPart2.threadId = reinterpret_cast<quint64>(QThread::currentThreadId());
#endif
if (canRender()) {
- // Clear all dirty flags but Compute so that
- // we still render every frame when a compute shader is used in a scene
- BackendNodeDirtySet changesToUnset = m_changeSet;
- if (changesToUnset.testFlag(Renderer::ComputeDirty))
- changesToUnset.setFlag(Renderer::ComputeDirty, false);
+ const BackendNodeDirtySet changesToUnset = m_changeSet;
clearDirtyBits(changesToUnset);
{ // Scoped to destroy surfaceLock
diff --git a/src/render/frontend/qcomputecommand.cpp b/src/render/frontend/qcomputecommand.cpp
index c36e4039c..e23f9e158 100644
--- a/src/render/frontend/qcomputecommand.cpp
+++ b/src/render/frontend/qcomputecommand.cpp
@@ -55,6 +55,12 @@ namespace Qt3DRender {
QComputeCommand is added to. The workGroupX, workGroupY and workGroupZ properties
specify the work group sizes for the compute shader invocation. Qt3DRender::QDispatchCompute
node needs to be present in the FrameGraph to actually issue the commands.
+
+ \note If the rendering policy is set to Qt3DRender::QRenderSettings::OnDemand and there are no
+ changes to the scene, the ComputeCommand will not be invoked repeatedly.
+ The Qt3DRender::QRenderSettings::Always render policy must be set for the ComputeCommand
+ to be repeatedly invoked if there are no other changes to the scene that triggers rendering a
+ new frame.
*/
/*!
@@ -70,6 +76,12 @@ namespace Qt3DRender {
ComputeCommand is added to. The workGroupX, workGroupY and workGroupZ properties
specify the work group sizes for the compute shader invocation. DispatchCompute
node needs to be present in the FrameGraph to actually issue the commands.
+
+ \note If the rendering policy is set to RenderSettings.OnDemand and there are no changes to the
+ scene, the ComputeCommand will not be invoked repeatedly.
+ The RenderSettings.Always render policy must be set for the ComputeCommand to be
+ repeatedly invoked if there are no other changes to the scene that triggers rendering a new
+ frame.
*/
/*!