summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2016-09-07 08:36:41 +0200
committerPaul Lemire <paul.lemire@kdab.com>2016-11-25 16:29:28 +0000
commitd9615a73455069f77e1dcdee7cbc39413703f69f (patch)
tree56a92255beca70040ddaf15d5f48362f076e6144 /src
parentd07496129a108a54345174b7651d1989cb9f157f (diff)
Technique: add a flag to check for compatibility
Will allow to avoid doing the expensive GraphicsApiFilterData comparison every frame but only when the Technique has actually changed. Change-Id: Ife4b6a03b7da5d157df33c7fc2770fea2d7b76fc Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/render/materialsystem/technique.cpp15
-rw-r--r--src/render/materialsystem/technique_p.h4
2 files changed, 19 insertions, 0 deletions
diff --git a/src/render/materialsystem/technique.cpp b/src/render/materialsystem/technique.cpp
index a3a650f7a..bf141ad28 100644
--- a/src/render/materialsystem/technique.cpp
+++ b/src/render/materialsystem/technique.cpp
@@ -63,6 +63,7 @@ namespace Render {
Technique::Technique()
: BackendNode()
+ , m_isCompatibleWithRenderer(false)
{
}
@@ -77,6 +78,7 @@ void Technique::cleanup()
m_parameterPack.clear();
m_renderPasses.clear();
m_filterKeyList.clear();
+ m_isCompatibleWithRenderer = false;
}
void Technique::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
@@ -98,6 +100,9 @@ void Technique::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
if (change->propertyName() == QByteArrayLiteral("graphicsApiFilterData")) {
GraphicsApiFilterData filterData = change->value().value<GraphicsApiFilterData>();
m_graphicsApiFilterData = filterData;
+ // Notify the manager that our graphicsApiFilterData has changed
+ // and that we therefore need to be check for compatibility again
+ m_isCompatibleWithRenderer = false;
}
break;
}
@@ -162,6 +167,16 @@ const GraphicsApiFilterData *Technique::graphicsApiFilter() const
return &m_graphicsApiFilterData;
}
+bool Technique::isCompatibleWithRenderer() const
+{
+ return m_isCompatibleWithRenderer;
+}
+
+void Technique::setCompatibleWithRenderer(bool compatible)
+{
+ m_isCompatibleWithRenderer = compatible;
+}
+
void Technique::appendFilterKey(Qt3DCore::QNodeId criterionId)
{
if (!m_filterKeyList.contains(criterionId))
diff --git a/src/render/materialsystem/technique_p.h b/src/render/materialsystem/technique_p.h
index 9686495b9..61e27550a 100644
--- a/src/render/materialsystem/technique_p.h
+++ b/src/render/materialsystem/technique_p.h
@@ -93,6 +93,9 @@ public:
QVector<Qt3DCore::QNodeId> renderPasses() const;
const GraphicsApiFilterData *graphicsApiFilter() const;
+ bool isCompatibleWithRenderer() const;
+ void setCompatibleWithRenderer(bool compatible);
+
private:
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
@@ -100,6 +103,7 @@ private:
ParameterPack m_parameterPack;
QVector<Qt3DCore::QNodeId> m_filterKeyList;
QVector<Qt3DCore::QNodeId> m_renderPasses;
+ bool m_isCompatibleWithRenderer;
};
} // namespace Render