Commit: 368f60fefd1730534cf4cd8bbbea62af5daa5134 Author: Alexander Gavrilov Date: Mon Dec 26 19:39:41 2022 +0200 Branches: temp-angavrilov https://developer.blender.org/rB368f60fefd1730534cf4cd8bbbea62af5daa5134
Depsgraph: clear update flags when skipping through no-op nodes. As an optimization, dependency graph evaluation skips through no-op nodes at the scheduling stage. However, that leaves update flags enabled on the node, and the most problematic one is the USER_MODIFIED flag, which get flushed to children every time the no-op node is tagged. This in turn can cause simulation caches downstream to be permanently stuck in an outdated state until the depsgraph is rebuilt and the stuck flag cleared out. Differential Revision: https://developer.blender.org/D16868 =================================================================== M source/blender/depsgraph/intern/eval/deg_eval.cc M source/blender/depsgraph/intern/node/deg_node_operation.h =================================================================== diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 5ca32d00ba5..739007a2ad4 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -104,9 +104,9 @@ void evaluate_node(const DepsgraphEvalState *state, OperationNode *operation_nod /* Clear the flag early on, allowing partial updates without re-evaluating the same node multiple * times. * This is a thread-safe modification as the node's flags are only read for a non-scheduled nodes - * and this node has been scheduled. */ - operation_node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE | - DEPSOP_FLAG_USER_MODIFIED); + * and this node has been scheduled. + * These also have to be cleared for no-op nodes in schedule_node. */ + operation_node->flag &= ~DEPSOP_FLAG_CLEAR_ON_EVAL; } void deg_task_run_func(TaskPool *pool, void *taskdata) @@ -270,6 +270,10 @@ void schedule_node(DepsgraphEvalState *state, bool is_scheduled = atomic_fetch_and_or_uint8((uint8_t *)&node->scheduled, uint8_t(true)); if (!is_scheduled) { if (node->is_noop()) { + /* Clear flags to avoid affecting subsequent update propagation. + * For normal nodes these are cleared in evaluate_node. */ + node->flag &= ~DEPSOP_FLAG_CLEAR_ON_EVAL; + /* skip NOOP node, schedule children right away */ schedule_children(state, node, schedule_fn); } diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.h b/source/blender/depsgraph/intern/node/deg_node_operation.h index 1bc4b36141e..df4a157d486 100644 --- a/source/blender/depsgraph/intern/node/deg_node_operation.h +++ b/source/blender/depsgraph/intern/node/deg_node_operation.h @@ -224,6 +224,10 @@ enum OperationFlag { /* Set of flags which gets flushed along the relations. */ DEPSOP_FLAG_FLUSH = (DEPSOP_FLAG_USER_MODIFIED), + + /* Set of flags which get cleared upon evaluation. */ + DEPSOP_FLAG_CLEAR_ON_EVAL = (DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE | + DEPSOP_FLAG_USER_MODIFIED), }; /* Atomic Operation - Base type for all operations */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs