diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2021-11-03 08:07:53 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-11-03 12:23:24 +0000 |
commit | 5661faeeb8301c0f114a138bb92d00c7e79028ea (patch) | |
tree | 867cf18f4e38e8ceb4d086beb8279547cbf9daf9 /src/render/backend/computecommand.cpp | |
parent | ec28fe968554f866e124ff716c7c0a7444942d5e (diff) |
ComputeCommand: call markDirty(ComputeDirty) when enabled changes
When using Manual run mode on a QComputeCommand, we rely on the enabled
property changing to enable/disable the backend ComputeCommand for a given
set of frames.
Since we weren't setting any dirty flag when the enabled property changed,
Qt 3D was not rebuilding the list of active compute commands but rather
using the one stored in its cache. This resulted in the ComputeCommand, now
disabled, to still be called for execution until something else triggered
a command rebuild.
The renderer calls ComputeDirty after it has executed a compute call.
This explains why eventually we only had 2 calls (and not a perpetual loop)
when calling trigger(1). One was the valid call, followed by the invalid one
(and then the command list got rebuilt because of the ComputeDirty flag set by
the renderer).
Task-number: QTBUG-86493
Change-Id: I7b31606a03609dc13294256b1dac89ee86730ba1
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
(cherry picked from commit 3d4ac623d444bbbaddc7f63163b204f6c6a55cab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/render/backend/computecommand.cpp')
-rw-r--r-- | src/render/backend/computecommand.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/render/backend/computecommand.cpp b/src/render/backend/computecommand.cpp index b961ffc53..adf7a2099 100644 --- a/src/render/backend/computecommand.cpp +++ b/src/render/backend/computecommand.cpp @@ -81,7 +81,10 @@ void ComputeCommand::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firs if (!node) return; + const bool wasEnabled = isEnabled(); BackendNode::syncFromFrontEnd(frontEnd, firstTime); + if (wasEnabled != isEnabled()) + markDirty(AbstractRenderer::ComputeDirty); if (m_workGroups[0] != node->workGroupX()) { m_workGroups[0] = node->workGroupX(); |