Depsgraph: Make certain components NOT tag copy-on-write when they are tagged
Currently done for mesh batch cache update, and for base flags sync. Those components do not need anything from original object, and hence can skip CoW tag and have faster update after them used.
This commit is contained in:
@@ -271,6 +271,26 @@ static void deg_debug_graphviz_relation_style(const DebugContext &ctx,
|
||||
deg_debug_fprintf(ctx, "%s", style);
|
||||
}
|
||||
|
||||
static void deg_debug_graphviz_relation_arrowhead(const DebugContext &ctx,
|
||||
const DepsRelation *rel)
|
||||
{
|
||||
const char *shape_default = "normal";
|
||||
const char *shape_no_cow = "box";
|
||||
const char *shape = shape_default;
|
||||
if (rel->from->get_class() == DEG_NODE_CLASS_OPERATION &&
|
||||
rel->to->get_class() == DEG_NODE_CLASS_OPERATION)
|
||||
{
|
||||
OperationDepsNode *op_from = (OperationDepsNode *)rel->from;
|
||||
OperationDepsNode *op_to = (OperationDepsNode *)rel->to;
|
||||
if (op_from->owner->type == DEG_NODE_TYPE_COPY_ON_WRITE &&
|
||||
!op_to->owner->need_tag_cow_before_update())
|
||||
{
|
||||
shape = shape_no_cow;
|
||||
}
|
||||
}
|
||||
deg_debug_fprintf(ctx, "%s", shape);
|
||||
}
|
||||
|
||||
static void deg_debug_graphviz_node_style(const DebugContext &ctx, const DepsNode *node)
|
||||
{
|
||||
const char *base_style = "filled"; /* default style */
|
||||
@@ -485,6 +505,8 @@ static void deg_debug_graphviz_node_relations(const DebugContext &ctx,
|
||||
deg_debug_graphviz_relation_color(ctx, rel);
|
||||
deg_debug_fprintf(ctx, ",style=");
|
||||
deg_debug_graphviz_relation_style(ctx, rel);
|
||||
deg_debug_fprintf(ctx, ",arrowhead=");
|
||||
deg_debug_graphviz_relation_arrowhead(ctx, rel);
|
||||
deg_debug_fprintf(ctx, ",penwidth=\"%f\"", penwidth);
|
||||
/* NOTE: edge from node to own cluster is not possible and gives graphviz
|
||||
* warning, avoid this here by just linking directly to the invisible
|
||||
|
||||
@@ -284,7 +284,7 @@ void depsgraph_tag_component(Depsgraph *graph,
|
||||
}
|
||||
}
|
||||
/* If component depends on copy-on-write, tag it as well. */
|
||||
if (component_node->depends_on_cow()) {
|
||||
if (component_node->need_tag_cow_before_update()) {
|
||||
ComponentDepsNode *cow_comp =
|
||||
id_node->find_component(DEG_NODE_TYPE_COPY_ON_WRITE);
|
||||
cow_comp->tag_update(graph);
|
||||
|
||||
@@ -144,8 +144,12 @@ struct ComponentDepsNode : public DepsNode {
|
||||
OperationDepsNode *entry_operation;
|
||||
OperationDepsNode *exit_operation;
|
||||
|
||||
// XXX: a poll() callback to check if component's first node can be started?
|
||||
virtual bool depends_on_cow() { return true; }
|
||||
|
||||
/* Denotes whether COW component is to be tagged when this component
|
||||
* is tagged for update.
|
||||
*/
|
||||
virtual bool need_tag_cow_before_update() { return true; }
|
||||
};
|
||||
|
||||
/* ---------------------------------------- */
|
||||
@@ -168,8 +172,14 @@ struct ComponentDepsNode : public DepsNode {
|
||||
DEG_COMPONENT_NODE_DECLARE; \
|
||||
}
|
||||
|
||||
#define DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(name) \
|
||||
struct name ## ComponentDepsNode : public ComponentDepsNode { \
|
||||
DEG_COMPONENT_NODE_DECLARE; \
|
||||
virtual bool need_tag_cow_before_update() { return false; } \
|
||||
}
|
||||
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(Animation);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(BatchCache);
|
||||
DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(BatchCache);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(Cache);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(CopyOnWrite);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(Geometry);
|
||||
@@ -182,7 +192,7 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(Sequencer);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(Shading);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(ShadingParameters);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(Transform);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(ObjectFromLayer);
|
||||
DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(ObjectFromLayer);
|
||||
|
||||
/* Bone Component */
|
||||
struct BoneComponentDepsNode : public ComponentDepsNode {
|
||||
|
||||
Reference in New Issue
Block a user