Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-06-24 12:13:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-06-24 13:23:00 +0300
commit27da305a404f72a75a37892e1ac080c6531d059b (patch)
tree3fb809530c31b63882e95fa6c4ed1d9d6577e13f /source/blender/depsgraph
parent67b352f9c5317c81c8e862a49be656c56e8f0743 (diff)
Depsgraph: support flushing parameters without a full COW update
Avoid computationally expensive copying operations when only some settings have been modified. This is done by adding support for updating parameters without tagging for copy-on-write. Currently only mesh data blocks are supported, other data-blocks can be added individually. This prepares for changing values such as edit-mesh auto-smooth angle in edit-mode without duplicating all mesh-data. The benefit will only be seen when the user interface no longer tags all ID's for copy on write updates. ID_RECALC_GEOMETRY_ALL_MODES has been added to support situations where non edit-mode geometry is modified in edit-mode. While this isn't something user are likely to do, Python scripts may change the underlying mesh. Reviewed By: sergey Ref D11377
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc14
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc3
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_component.h18
3 files changed, 33 insertions, 2 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 20169f0a961..56168739fae 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -1215,7 +1215,19 @@ void DepsgraphNodeBuilder::build_parameters(ID *id)
op_node = add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_ENTRY);
op_node->set_as_entry();
/* Generic evaluation node. */
- add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL);
+
+ if (ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW(GS(id->name))) {
+ ID *id_cow = get_cow_id(id);
+ add_operation_node(
+ id,
+ NodeType::PARAMETERS,
+ OperationCode::PARAMETERS_EVAL,
+ [id_cow, id](::Depsgraph * /*depsgraph*/) { BKE_id_eval_properties_copy(id_cow, id); });
+ }
+ else {
+ add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL);
+ }
+
/* Explicit exit operation. */
op_node = add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT);
op_node->set_as_exit();
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 21a6728c364..b00cae87311 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -230,6 +230,7 @@ void depsgraph_tag_to_component_opcode(const ID *id,
case ID_RECALC_SOURCE:
*component_type = NodeType::PARAMETERS;
break;
+ case ID_RECALC_GEOMETRY_ALL_MODES:
case ID_RECALC_ALL:
case ID_RECALC_PSYS_ALL:
BLI_assert(!"Should not happen");
@@ -705,6 +706,8 @@ const char *DEG_update_tag_as_string(IDRecalcFlag flag)
return "TRANSFORM";
case ID_RECALC_GEOMETRY:
return "GEOMETRY";
+ case ID_RECALC_GEOMETRY_ALL_MODES:
+ return "GEOMETRY_ALL_MODES";
case ID_RECALC_ANIMATION:
return "ANIMATION";
case ID_RECALC_PSYS_REDO:
diff --git a/source/blender/depsgraph/intern/node/deg_node_component.h b/source/blender/depsgraph/intern/node/deg_node_component.h
index 06582c88d8b..a7c69b27654 100644
--- a/source/blender/depsgraph/intern/node/deg_node_component.h
+++ b/source/blender/depsgraph/intern/node/deg_node_component.h
@@ -23,7 +23,9 @@
#pragma once
+#include "intern/eval/deg_eval_copy_on_write.h"
#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_id.h"
#include "intern/node/deg_node_operation.h"
#include "BLI_string.h"
@@ -172,7 +174,6 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(CopyOnWrite);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Geometry);
DEG_COMPONENT_NODE_DECLARE_GENERIC(ImageAnimation);
DEG_COMPONENT_NODE_DECLARE_GENERIC(LayerCollections);
-DEG_COMPONENT_NODE_DECLARE_GENERIC(Parameters);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Particles);
DEG_COMPONENT_NODE_DECLARE_GENERIC(ParticleSettings);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Pose);
@@ -199,6 +200,21 @@ struct BoneComponentNode : public ComponentNode {
DEG_COMPONENT_NODE_DECLARE;
};
+/* Eventually we would not tag parameters in all cases.
+ * Support for this each ID needs to be added on an individual basis. */
+struct ParametersComponentNode : public ComponentNode {
+ virtual bool need_tag_cow_before_update() override
+ {
+ if (ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW(owner->id_type)) {
+ BLI_assert(deg_copy_on_write_is_expanded(owner->id_cow));
+ return false;
+ }
+ return true;
+ }
+
+ DEG_COMPONENT_NODE_DECLARE;
+};
+
void deg_register_component_depsnodes();
} // namespace deg