Vulkan: Fix memory leak in render graph #120906
|
@ -29,6 +29,9 @@ void VKRenderGraph::remove_nodes(Span<NodeHandle> node_handles)
|
|||
"nodes, and will use incorrect ordering when not all nodes are removed. This "
|
||||
"needs to be fixed when implementing a better scheduler.");
|
||||
links_.clear();
|
||||
for (VKRenderGraphNode &node : nodes_) {
|
||||
node.free_data();
|
||||
}
|
||||
nodes_.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -194,12 +194,9 @@ struct VKRenderGraphNode {
|
|||
}
|
||||
|
||||
/**
|
||||
* Reset nodes.
|
||||
*
|
||||
* Nodes are reset so they can be reused in consecutive calls. Data allocated by the node are
|
||||
* freed. This function dispatches the free_data to the actual node implementation.
|
||||
* Free data kept by the node
|
||||
*/
|
||||
void reset()
|
||||
void free_data()
|
||||
{
|
||||
switch (type) {
|
||||
case VKNodeType::DISPATCH: {
|
||||
|
@ -220,7 +217,17 @@ struct VKRenderGraphNode {
|
|||
case VKNodeType::SYNCHRONIZATION:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset nodes.
|
||||
*
|
||||
* Nodes are reset so they can be reused in consecutive calls. Data allocated by the node are
|
||||
* freed. This function dispatches the free_data to the actual node implementation.
|
||||
*/
|
||||
void reset()
|
||||
{
|
||||
free_data();
|
||||
memset(this, 0, sizeof(VKRenderGraphNode));
|
||||
type = VKNodeType::UNUSED;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue