1// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "dispatchcompute_p.h"
5#include <Qt3DRender/private/qdispatchcompute_p.h>
6
7QT_BEGIN_NAMESPACE
8
9namespace Qt3DRender {
10
11namespace Render {
12
13DispatchCompute::DispatchCompute()
14 : FrameGraphNode(FrameGraphNode::ComputeDispatch)
15{
16 m_workGroups[0] = 1;
17 m_workGroups[1] = 1;
18 m_workGroups[2] = 1;
19}
20
21DispatchCompute::~DispatchCompute()
22{
23}
24
25void DispatchCompute::cleanup()
26{
27 m_workGroups[0] = 1;
28 m_workGroups[1] = 1;
29 m_workGroups[2] = 1;
30}
31
32void DispatchCompute::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime)
33{
34 const QDispatchCompute *node = qobject_cast<const QDispatchCompute *>(object: frontEnd);
35 if (!node)
36 return;
37
38 FrameGraphNode::syncFromFrontEnd(frontEnd, firstTime);
39
40 if (m_workGroups[0] != node->workGroupX()) {
41 m_workGroups[0] = node->workGroupX();
42 markDirty(changes: AbstractRenderer::FrameGraphDirty|AbstractRenderer::ComputeDirty);
43 }
44 if (m_workGroups[1] != node->workGroupY()) {
45 m_workGroups[1] = node->workGroupY();
46 markDirty(changes: AbstractRenderer::FrameGraphDirty|AbstractRenderer::ComputeDirty);
47 }
48 if (m_workGroups[2] != node->workGroupZ()) {
49 m_workGroups[2] = node->workGroupZ();
50 markDirty(changes: AbstractRenderer::FrameGraphDirty|AbstractRenderer::ComputeDirty);
51 }
52}
53
54} // Render
55
56} // Qt3DRender
57
58QT_END_NAMESPACE
59

source code of qt3d/src/render/framegraph/dispatchcompute.cpp