summaryrefslogtreecommitdiffstats
path: root/src/render/lights
diff options
context:
space:
mode:
authorJames Turner <zakalawe@mac.com>2018-11-14 13:22:28 +0000
committerJames Turner <james.turner@kdab.com>2019-02-20 09:57:01 +0000
commiteedd6402ecc00b7a8f382573fb63faf615ab4a54 (patch)
tree313438705170bc205db8b7109bbb9f17cd7668bb /src/render/lights
parentd23bb633574fbfefde8a6b718487a448fb6d936b (diff)
Cache light/renderable/computable vectors
This avoids running these jobs when lights / renderables have not changed in a frame Change-Id: I604180fe3442ab67648c4ba5d9effb8639c68ef7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/render/lights')
-rw-r--r--src/render/lights/light.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/render/lights/light.cpp b/src/render/lights/light.cpp
index 1e1855349..e8474b728 100644
--- a/src/render/lights/light.cpp
+++ b/src/render/lights/light.cpp
@@ -63,6 +63,9 @@ void Light::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QAbstractLightData>>(change);
const auto &data = typedChange->data;
m_shaderDataId = data.shaderDataId;
+
+ Q_ASSERT(m_renderer);
+ BackendNode::markDirty(AbstractRenderer::LightsDirty);
}
RenderLightFunctor::RenderLightFunctor(AbstractRenderer *renderer, NodeManagers *managers)
@@ -85,6 +88,8 @@ Qt3DCore::QBackendNode *RenderLightFunctor::get(Qt3DCore::QNodeId id) const
void RenderLightFunctor::destroy(Qt3DCore::QNodeId id) const
{
+ Light *backend = m_managers->lightManager()->getOrCreateResource(id);
+ m_renderer->markDirty(AbstractRenderer::LightsDirty, backend);
m_managers->lightManager()->releaseResource(id);
}