1// Copyright (C) 2016 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 "filtercompatibletechniquejob_p.h"
5#include <Qt3DRender/private/techniquemanager_p.h>
6#include <Qt3DRender/private/nodemanagers_p.h>
7#include <Qt3DRender/private/job_common_p.h>
8
9QT_BEGIN_NAMESPACE
10
11namespace Qt3DRender {
12namespace Render {
13
14FilterCompatibleTechniqueJob::FilterCompatibleTechniqueJob()
15 : m_manager(nullptr)
16 , m_renderer(nullptr)
17{
18 SET_JOB_RUN_STAT_TYPE(this, JobTypes::FilterCompatibleTechniques, 0)
19}
20
21void FilterCompatibleTechniqueJob::setManager(TechniqueManager *manager)
22{
23 m_manager = manager;
24}
25
26TechniqueManager *FilterCompatibleTechniqueJob::manager() const
27{
28 return m_manager;
29}
30
31void FilterCompatibleTechniqueJob::setRenderer(AbstractRenderer *renderer)
32{
33 m_renderer = renderer;
34}
35
36AbstractRenderer *FilterCompatibleTechniqueJob::renderer() const
37{
38 return m_renderer;
39}
40
41void FilterCompatibleTechniqueJob::run()
42{
43 Q_ASSERT(m_manager != nullptr && m_renderer != nullptr);
44 Q_ASSERT(m_renderer->isRunning());
45
46 const std::vector<Qt3DCore::QNodeId> dirtyTechniqueIds = m_manager->takeDirtyTechniques();
47 for (const Qt3DCore::QNodeId &techniqueId : dirtyTechniqueIds) {
48 Technique *technique = m_manager->lookupResource(id: techniqueId);
49 if (Q_LIKELY(technique != nullptr))
50 technique->setCompatibleWithRenderer((*m_renderer->contextInfo() == *technique->graphicsApiFilter()));
51 }
52}
53
54} // namespace Render
55} // namespace Qt3DRender
56
57QT_END_NAMESPACE
58

source code of qt3d/src/render/jobs/filtercompatibletechniquejob.cpp