aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick3d/qquick3dcustommaterial.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick3d/qquick3dcustommaterial.cpp')
-rw-r--r--src/quick3d/qquick3dcustommaterial.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/quick3d/qquick3dcustommaterial.cpp b/src/quick3d/qquick3dcustommaterial.cpp
index b0b5377e..9534146e 100644
--- a/src/quick3d/qquick3dcustommaterial.cpp
+++ b/src/quick3d/qquick3dcustommaterial.cpp
@@ -512,6 +512,22 @@ QSSGRenderGraphObject *QQuick3DCustomMaterial::updateSpatialNode(QSSGRenderGraph
}
}
+ // We need to mark the commands that we allocated since they will need to be deallocted when the customMaterial is deleted.
+ // We achieve this by filtering on the command type.
+ qDeleteAll(customMaterial->commandsToDelete);
+ customMaterial->commandsToDelete.clear();
+ for (auto command : customMaterial->commands) {
+ if (command->m_type != dynamic::CommandType::AllocateBuffer &&
+ command->m_type != dynamic::CommandType::ApplyBufferValue &&
+ command->m_type != dynamic::CommandType::ApplyBlitFramebuffer &&
+ command->m_type != dynamic::CommandType::ApplyBlending &&
+ command->m_type != dynamic::CommandType::ApplyRenderState &&
+ command->m_type != dynamic::CommandType::ApplyCullMode &&
+ command->m_type != dynamic::CommandType::ApplyDepthValue &&
+ command->m_type != dynamic::CommandType::ApplyValue)
+ customMaterial->commandsToDelete.insert(command);
+ }
+
QQuick3DMaterial::updateSpatialNode(customMaterial);
if (m_dirtyAttributes & Dirty::PropertyDirty) {