diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-01-13 12:17:01 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-01-13 14:13:35 +0300 |
commit | 76fd41e9db19dd2a33fae0e690f76792b13d49ed (patch) | |
tree | f185e2d877b20ee7264c84a4a41a343af6f02d0e /source | |
parent | 0f95f51361d73fbd8ba8d80b3b65da930dcf3b20 (diff) |
Depsgraph: Remove redundant copy-on-write operations
This change removes copy-on-write operations from ID nodes which do not
need copy-on-write.
Should be no functional changes, as before the copy-on-write operation
would do nothing for those nodes anyway.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | 7 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index f5298acc498..39dc4b32ca1 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -155,6 +155,7 @@ IDNode *DepsgraphNodeBuilder::add_id_node(ID *id) { BLI_assert(id->session_uuid != MAIN_ID_SESSION_UUID_UNSET); + const ID_Type id_type = GS(id->name); IDNode *id_node = nullptr; ID *id_cow = nullptr; IDComponentsMask previously_visible_components_mask = 0; @@ -173,10 +174,8 @@ IDNode *DepsgraphNodeBuilder::add_id_node(ID *id) id_node->previously_visible_components_mask = previously_visible_components_mask; id_node->previous_eval_flags = previous_eval_flags; id_node->previous_customdata_masks = previous_customdata_masks; - /* Currently all ID nodes are supposed to have copy-on-write logic. - * - * NOTE: Zero number of components indicates that ID node was just created. */ - if (id_node->components.is_empty()) { + /* NOTE: Zero number of components indicates that ID node was just created. */ + if (id_node->components.is_empty() && deg_copy_on_write_is_needed(id_type)) { ComponentNode *comp_cow = id_node->add_component(NodeType::COPY_ON_WRITE); OperationNode *op_cow = comp_cow->add_operation( function_bind(deg_evaluate_copy_on_write, _1, id_node), diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 556b60b930b..0eeef1840b6 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -2807,7 +2807,13 @@ void DepsgraphRelationBuilder::build_nested_shapekey(ID *owner, Key *key) void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) { ID *id_orig = id_node->id_orig; + const ID_Type id_type = GS(id_orig->name); + + if (!deg_copy_on_write_is_needed(id_type)) { + return; + } + TimeSourceKey time_source_key; OperationKey copy_on_write_key(id_orig, NodeType::COPY_ON_WRITE, OperationCode::COPY_ON_WRITE); /* XXX: This is a quick hack to make Alt-A to work. */ |