diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-05-02 03:23:34 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-05-03 02:20:33 +0300 |
commit | 5a964664d6cf54deb3d5590f8581683f865af747 (patch) | |
tree | 15d5cc5bd170ab512944c058ae6c63feca6ca6f4 /intern/cycles/blender | |
parent | 5ffab01930cd1744d5412bf14ce92c8d29cf2d9a (diff) |
Cycles: add reference counting to Nodes
This adds a reference count to Nodes which is incremented or decremented
whenever they are added to or removed from a socket, which will help us
track used Nodes throughout the scene graph generically without having to
add an explicit count or flag on specific Node types. This is especially
useful to track Nodes defined through Procedurals out of Cycles' control.
This also modifies the order in which nodes are deleted to ensure that
upon deletion, a Node does not attempt to decrement the reference
count of another Node which was already freed or deleted.
This is not currently used, but will be in the next commit.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D10965
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 54128cf82fc..619cdf98fa1 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -560,10 +560,12 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph, if (!cancel && !motion) { sync_background_light(b_v3d, use_portal); - /* handle removed data and modified pointers */ + /* Handle removed data and modified pointers, as this may free memory, delete Nodes in the + * right order to ensure that dependant data is freed after their users. Objects should be + * freed before particle systems and geometries. */ light_map.post_sync(); - geometry_map.post_sync(); object_map.post_sync(); + geometry_map.post_sync(); particle_system_map.post_sync(); } |