Blender Git Loki

Git Commits -> Revision 7e712b2

Revision 7e712b2 by Jacques Lucke (master)
December 21, 2021, 14:18 (GMT)
Nodes: refactor node tree update handling

Goals of this refactor:
* More unified approach to updating everything that needs to be updated
after a change in a node tree.
* The updates should happen in the correct order and quadratic or worse
algorithms should be avoided.
* Improve detection of changes to the output to avoid tagging the depsgraph
when it's not necessary.
* Move towards a more declarative style of defining nodes by having a
more centralized update procedure.

The refactor consists of two main parts:
* Node tree tagging and update refactor.
* Generally, when changes are done to a node tree, it is tagged dirty
until a global update function is called that updates everything in
the correct order.
* The tagging is more fine-grained compared to before, to allow for more
precise depsgraph update tagging.
* Depsgraph changes.
* The shading specific depsgraph node for node trees as been removed.
* Instead, there is a new `NTREE_OUTPUT` depsgrap node, which is only
tagged when the output of the node tree changed (e.g. the Group Output
or Material Output node).
* The copy-on-write relation from node trees to the data block they are
embedded in is now non-flushing. This avoids e.g. triggering a material
update after the shader node tree changed in unrelated ways. Instead
the material has a flushing relation to the new `NTREE_OUTPUT` node now.
* The depsgraph no longer reports data block changes through to cycles
through `Depsgraph.updates` when only the node tree changed in ways
that do not affect the output.

Avoiding unnecessary updates seems to work well for geometry nodes and cycles.
The situation is a bit worse when there are drivers on the node tree, but that
could potentially be improved separately in the future.

Avoiding updates in eevee and the compositor is more tricky, but also less urgent.
* Eevee updates are triggered by calling `DRW_notify_view_update` in
`ED_render_view3d_update` indirectly from `DEG_editors_update`.
* Compositor updates are triggered by `ED_node_composite_job` in `node_area_refresh`.
This is triggered by calling `ED_area_tag_refresh` in `node_area_listener`.

Removing updates always has the risk of breaking some dependency that no
one was aware of. It's not unlikely that this will happen here as well. Adding
back missing updates should be quite a bit easier than getting rid of
unnecessary updates though.

Differential Revision: https://developer.blender.org/D13246

Commit Details:

Full Hash: 7e712b2d6a0d257d272ed35622b41d06274af8df
Parent Commit: 1abf2f3
Lines Changed: +2251, -1704

2 Added Paths:

/source/blender/blenkernel/BKE_node_tree_update.h (+109, -0) (View)
/source/blender/blenkernel/intern/node_tree_update.cc (+1658, -0) (View)

67 Modified Paths:

/source/blender/blenkernel/BKE_node.h (+2, -9) (Diff)
/source/blender/blenkernel/CMakeLists.txt (+2, -0) (Diff)
/source/blender/blenkernel/intern/image.c (+3, -10) (Diff)
/source/blender/blenkernel/intern/lib_remap.c (+1, -1) (Diff)
/source/blender/blenkernel/intern/linestyle.c (+2, -1) (Diff)
/source/blender/blenkernel/intern/movieclip.c (+2, -11) (Diff)
/source/blender/blenkernel/intern/node.cc (+34, -748) (Diff)
/source/blender/blenloader/intern/versioning_250.c (+5, -4) (Diff)
/source/blender/blenloader/intern/versioning_280.c (+2, -1) (Diff)
/source/blender/blenloader/intern/versioning_300.c (+1, -2) (Diff)
/source/blender/blenloader/intern/versioning_common.cc (+20, -0) (Diff)
/source/blender/blenloader/intern/versioning_common.h (+2, -0) (Diff)
/source/blender/blenloader/intern/versioning_cycles.c (+15, -14) (Diff)
/source/blender/blenloader/intern/versioning_defaults.c (+3, -2) (Diff)
/source/blender/depsgraph/DEG_depsgraph_build.h (+3, -3) (Diff)
/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc (+2, -2) (Diff)
/source/blender/depsgraph/intern/builder/deg_builder_relations.cc (+43, -30) (Diff)
/source/blender/depsgraph/intern/builder/deg_builder_relations.h (+1, -1) (Diff)
/source/blender/depsgraph/intern/builder/deg_builder_rna.cc (+1, -1) (Diff)
/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc (+1, -0) (Diff)
/source/blender/depsgraph/intern/depsgraph_build.cc (+7, -7) (Diff)
/source/blender/depsgraph/intern/depsgraph_query_iter.cc (+6, -3) (Diff)
/source/blender/depsgraph/intern/depsgraph_tag.cc (+6, -0) (Diff)
/source/blender/depsgraph/intern/node/deg_node.cc (+4, -0) (Diff)
/source/blender/depsgraph/intern/node/deg_node.h (+2, -0) (Diff)
/source/blender/depsgraph/intern/node/deg_node_component.cc (+2, -0) (Diff)
/source/blender/depsgraph/intern/node/deg_node_component.h (+1, -0) (Diff)
/source/blender/depsgraph/intern/node/deg_node_operation.cc (+3, -0) (Diff)
/source/blender/depsgraph/intern/node/deg_node_operation.h (+3, -0) (Diff)
/source/blender/editors/include/ED_node.h (+21, -1) (Diff)
/source/blender/editors/render/render_internal.c (+3, -1) (Diff)
/source/blender/editors/sculpt_paint/paint_image_proj.c (+1, -1) (Diff)
/source/blender/editors/space_node/drawnode.cc (+3, -1) (Diff)
/source/blender/editors/space_node/link_drag_search.cc (+5, -5) (Diff)
/source/blender/editors/space_node/node_add.cc (+9, -40) (Diff)
/source/blender/editors/space_node/node_draw.cc (+0, -29) (Diff)
/source/blender/editors/space_node/node_edit.cc (+61, -135) (Diff)
/source/blender/editors/space_node/node_group.cc (+11, -31) (Diff)
/source/blender/editors/space_node/node_intern.hh (+0, -5) (Diff)
/source/blender/editors/space_node/node_relationships.cc (+24, -215) (Diff)
/source/blender/editors/space_node/node_templates.cc (+9, -14) (Diff)
/source/blender/editors/space_node/space_node.cc (+17, -5) (Diff)
/source/blender/editors/transform/transform_convert_mask.c (+1, -6) (Diff)
/source/blender/editors/transform/transform_convert_node.c (+2, -1) (Diff)
/source/blender/editors/transform/transform_convert_tracking.c (+8, -2) (Diff)
/source/blender/editors/uvedit/uvedit_ops.c (+1, -1) (Diff)
/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp (+2, -1) (Diff)
/source/blender/io/collada/Materials.cpp (+3, -1) (Diff)
/source/blender/io/usd/intern/usd_reader_material.cc (+2, -1) (Diff)
/source/blender/makesdna/DNA_ID.h (+3, -0) (Diff)
/source/blender/makesdna/DNA_node_types.h (+20, -25) (Diff)
/source/blender/makesrna/intern/rna_color.c (+1, -1) (Diff)
/source/blender/makesrna/intern/rna_image.c (+1, -1) (Diff)
/source/blender/makesrna/intern/rna_nodetree.c (+49, -94) (Diff)
/source/blender/makesrna/intern/rna_texture.c (+1, -1) (Diff)
/source/blender/makesrna/intern/rna_tracking.c (+4, -2) (Diff)
/source/blender/modifiers/intern/MOD_nodes.cc (+3, -2) (Diff)
/source/blender/nodes/composite/node_composite_tree.cc (+4, -7) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc (+10, -19) (Diff)
/source/blender/nodes/intern/node_common.cc (+1, -2) (Diff)
/source/blender/nodes/intern/node_exec.cc (+2, -1) (Diff)
/source/blender/nodes/intern/node_socket.cc (+8, -0) (Diff)
/source/blender/nodes/intern/node_tree_ref.cc (+2, -0) (Diff)
/source/blender/nodes/intern/node_util.c (+1, -182) (Diff)
/source/blender/nodes/shader/node_shader_tree.c (+11, -15) (Diff)
/source/blender/nodes/texture/node_texture_tree.c (+0, -5) (Diff)
/source/blender/render/intern/pipeline.c (+1, -1) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021