Commit da5a4af5 authored by Paul Lemire's avatar Paul Lemire
Browse files

ShaderBuilder: ensure no old updates are left over



Could result in trying to send updates to nodes which have been destroyed.

Change-Id: I3709277e5005f25ec8cb9efe0a2152f879bea89f
Reviewed-by: Mike Krus's avatarMike Krus <mike.krus@kdab.com>
parent f8ab6143
......@@ -145,6 +145,7 @@ void ShaderBuilder::cleanup()
m_enabledLayers.clear();
m_graphs.clear();
m_dirtyTypes.clear();
m_pendingUpdates.clear();
QBackendNode::setEnabled(false);
}
......
......@@ -95,7 +95,7 @@ public:
void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override;
QVector<ShaderBuilderUpdate> &updates() { return m_pendingUpdates; }
QVector<ShaderBuilderUpdate> takePendingUpdates() { return std::move(m_pendingUpdates); }
private:
void setEnabledLayers(const QStringList &layers);
......
......@@ -1115,7 +1115,7 @@ void Renderer::reloadDirtyShaders()
if (shaderBuilder->isShaderCodeDirty(shaderType)) {
shaderBuilder->generateCode(shaderType);
m_shaderBuilderUpdates.append(std::move(shaderBuilder->updates()));
m_shaderBuilderUpdates.append(shaderBuilder->takePendingUpdates());
}
const auto code = shaderBuilder->shaderCode(shaderType);
......@@ -1143,9 +1143,9 @@ void Renderer::sendShaderChangesToFrontend(Qt3DCore::QAspectManager *manager)
if (s->requiresFrontendSync()) {
QShaderProgram *frontend = static_cast<decltype(frontend)>(manager->lookupNode(s->peerId()));
QShaderProgramPrivate *dFrontend = static_cast<decltype(dFrontend)>(QNodePrivate::get(frontend));
s->unsetRequiresFrontendSync();
dFrontend->setStatus(s->status());
dFrontend->setLog(s->log());
s->unsetRequiresFrontendSync();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment