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.
This commit is contained in:
Sergey Sharybin 2021-01-13 10:17:01 +01:00
parent 0f95f51361
commit 76fd41e9db
Notes: blender-bot 2023-06-26 11:58:59 +02:00
Referenced by commit 133966423a, Revert "Depsgraph: Remove redundant copy-on-write operations"
Referenced by commit 61d1fd7e2f, Fix T85142: BMW scene quits Blender
Referenced by issue #84717, Shading changes in the viewport shading popup menu require movement in the 3D viewport to take affect.
2 changed files with 9 additions and 4 deletions

View File

@ -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),

View File

@ -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. */