|
Blender V5.3
|
Classes | |
| class | bNodeTreeBitGroupVectorOptions |
| class | NodeDeclaration |
| struct | ReferenceLifetimesInfo |
| struct | ReferenceSetInfo |
Typedefs | |
| using | BitInt |
Enumerations | |
| enum class | ReferenceSetType { GroupOutputData , ClosureOutputData , GroupInputReferenceSet , ClosureInputReferenceSet , LocalReferenceSet } |
Functions | |
| bool | analyse_reference_lifetimes (bNodeTree &tree) |
| bool | can_contain_reference (eNodeSocketDatatype socket_type) |
| bool | can_contain_referenced_data (eNodeSocketDatatype socket_type) |
| std::ostream & | operator<< (std::ostream &stream, const ReferenceSetInfo &info) |
| static bool | socket_may_have_reference (const bNodeSocket &socket) |
| static bool | or_into_each_other_masked (MutableBoundedBitSpan a, MutableBoundedBitSpan b, const BoundedBitSpan mask) |
| static bool | or_into_each_other (MutableBoundedBitSpan a, MutableBoundedBitSpan b) |
| static const bNodeTreeZone * | get_zone_of_node_if_full (const bNodeTreeZones *zones, const bNode &node) |
| static Array< const rl::RelationsInNode * > | prepare_relations_by_node (const bNodeTree &tree, ResourceScope &scope) |
| static Vector< ReferenceSetInfo > | find_reference_sets (const bNodeTree &tree, const Span< const rl::RelationsInNode * > &relations_by_node, Vector< int > &r_group_output_reference_sets, MultiValueMap< const bNodeTreeZone *, int > &r_output_set_sources_by_closure_zone) |
| static void | set_initial_data_and_reference_bits (const bNodeTree &tree, const Span< ReferenceSetInfo > reference_sets, BitGroupVector<> &r_potential_data_by_socket, BitGroupVector<> &r_potential_reference_by_socket) |
| static BitVector | get_references_coming_from_outside_zone (const bNodeTreeZone &zone, const Span< const BitGroupVector<> * > sources) |
| static bool | pass_left_to_right (const bNodeTree &tree, const Span< const rl::RelationsInNode * > &relations_by_node, BitGroupVector<> &r_potential_data_by_socket, BitGroupVector<> &r_potential_reference_by_socket) |
| static void | prepare_required_data_for_group_outputs (const bNodeTree &tree, const Span< ReferenceSetInfo > reference_sets, const Span< int > group_output_set_sources, const BitGroupVector<> &potential_data_by_socket, const BitGroupVector<> &potential_reference_by_socket, BitGroupVector<> &r_required_data_by_socket) |
| static void | prepare_required_data_for_closure_outputs (const bNodeTree &tree, const Span< ReferenceSetInfo > reference_sets, MultiValueMap< const bNodeTreeZone *, int > &output_set_sources_by_closure_zone, const BitGroupVector<> &potential_data_by_socket, const BitGroupVector<> &potential_reference_by_socket, BitGroupVector<> &r_required_data_by_socket) |
| static void | prepare_required_data_for_outputs (const bNodeTree &tree, const Span< ReferenceSetInfo > reference_sets, const Span< int > group_output_set_sources, MultiValueMap< const bNodeTreeZone *, int > &output_set_sources_by_closure_zone, const BitGroupVector<> &potential_data_by_socket, const BitGroupVector<> &potential_reference_by_socket, BitGroupVector<> &r_required_data_by_socket) |
| static bool | pass_right_to_left (const bNodeTree &tree, const Span< const rl::RelationsInNode * > &relations_by_node, const BitGroupVector<> &potential_reference_by_socket, BitGroupVector<> &r_required_data_by_socket) |
| static rl::RelationsInNode | get_tree_relations (const bNodeTree &tree, const Span< ReferenceSetInfo > reference_sets, const BitGroupVector<> &potential_data_by_socket, const BitGroupVector<> &potential_reference_by_socket, const BitGroupVector<> &required_data_by_socket) |
| static void | disable_unused_group_output_propagation (const Span< ReferenceSetInfo > reference_sets, const Span< rl::DataPropagation > &propagate_relations, BitGroupVector<> &required_data_by_socket) |
| static std::unique_ptr< ReferenceLifetimesInfo > | make_reference_lifetimes_info (const bNodeTree &tree) |
Geometry nodes has the concept of anonymous attributes. These are attributes that are created by some node with an internal name that is not exposed to the user. The only way to use this attribute is to make a link in the node tree to the node that should use it. This explicitness allows us to automatically determine when anonymous attributes are not needed anymore and should be deleted (or not created in the first place).
This file is used to determine the lifetimes of these anonymous attributes. The logic is fairly straight forward to extend to other kinds of referenced data, but for now we only have anonymous attributes.
The lifetime analysis uses information provided in the node declaration and hardcoded behavior for some special nodes like zones to determine the following things among others.
This information is later used when evaluating geometry nodes to reduce the lifetime of anonymous attributes automatically.
| using blender::bits::BitInt |
Using a large integer type is better because then it's easier to process many bits at once.
Definition at line 29 of file BLI_bit_ref.hh.
|
strong |
| Enumerator | |
|---|---|
| GroupOutputData | Corresponds to geometry outputs that may contain attributes that are propagated from a group input. In such cases, the caller may provide a set of attributes that should be propagated. |
| ClosureOutputData | |
| GroupInputReferenceSet | Field inputs may require attributes that need to be propagated from other geometry inputs to the node that evaluates the field. |
| ClosureInputReferenceSet | |
| LocalReferenceSet | Locally created anonymous attributes (like with the Capture Attribute node) need to be propagated to the nodes that use them or even to the group output. |
Definition at line 41 of file BKE_node_tree_reference_lifetimes.hh.
| bool blender::bke::node_tree_reference_lifetimes::analyse_reference_lifetimes | ( | bNodeTree & | tree | ) |
Definition at line 1064 of file node_tree_reference_lifetimes.cc.
References analyse_reference_lifetimes(), make_reference_lifetimes_info(), blender::bke::bNodeTreeRuntime::reference_lifetimes_info, and blender::bNodeTree::runtime.
Referenced by analyse_reference_lifetimes().
| bool blender::bke::node_tree_reference_lifetimes::can_contain_reference | ( | eNodeSocketDatatype | socket_type | ) |
The socket type allows storing references to data stored elsewhere.
Definition at line 88 of file node_tree_reference_lifetimes.cc.
References can_contain_reference(), ELEM, blender::SOCK_BUNDLE, blender::SOCK_CLOSURE, blender::SOCK_GEOMETRY, and blender::nodes::socket_type_supports_fields().
Referenced by can_contain_reference(), blender::nodes::node_geo_evaluate_closure_cc::create_all_reference_lifetime_relations(), find_reference_sets(), and get_tree_relations().
| bool blender::bke::node_tree_reference_lifetimes::can_contain_referenced_data | ( | eNodeSocketDatatype | socket_type | ) |
The socket type allows storing data that may be referenced elsewhere.
Definition at line 94 of file node_tree_reference_lifetimes.cc.
References can_contain_referenced_data(), ELEM, blender::SOCK_BUNDLE, blender::SOCK_CLOSURE, and blender::SOCK_GEOMETRY.
Referenced by can_contain_referenced_data(), blender::nodes::node_geo_evaluate_closure_cc::create_all_reference_lifetime_relations(), find_reference_sets(), get_tree_relations(), prepare_relations_by_node(), prepare_required_data_for_closure_outputs(), and prepare_required_data_for_group_outputs().
|
static |
After creating detecting the final propagate-relations, we can detect some input geometry that looked like it was passed to the output actually is not. So we can update #required_data_by_socket to never use the corresponding ReferenceSetInfo.
Definition at line 962 of file node_tree_reference_lifetimes.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Vector< T, InlineBufferCapacity, Allocator >::contains(), disable_unused_group_output_propagation(), blender::bits::BitGroupVector< InlineBufferCapacity, Allocator >::foreach_and(), GroupOutputData, blender::Span< T >::index_range(), blender::Span< T >::size(), and blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::type.
Referenced by disable_unused_group_output_propagation(), and make_reference_lifetimes_info().
|
static |
Definition at line 238 of file node_tree_reference_lifetimes.cc.
References blender::MultiValueMap< Key, Value >::add(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Vector< T, InlineBufferCapacity, Allocator >::append_and_get_index(), blender::Vector< T, InlineBufferCapacity, Allocator >::as_mutable_span(), can_contain_reference(), can_contain_referenced_data(), ClosureInputReferenceSet, find_reference_sets(), GroupInputReferenceSet, blender::Span< T >::index_range(), blender::IndexRange::IndexRange(), blender::bke::bNodeTreeZone::input_node(), blender::Vector< T, InlineBufferCapacity, Allocator >::last(), LocalReferenceSet, node, NODE_CLOSURE_OUTPUT, blender::bke::bNodeTreeZone::output_node(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::SOCK_CUSTOM, blender::bNode::storage, storage, blender::bke::bNodeSocketType::type, blender::bNodeSocket::type, blender::bNode::type_legacy, and blender::bke::bNodeTreeZones::zones.
Referenced by find_reference_sets(), and make_reference_lifetimes_info().
|
static |
Definition at line 378 of file node_tree_reference_lifetimes.cc.
References blender::bke::bNodeTreeZone::border_links, blender::bNodeLink::fromsock, get_references_coming_from_outside_zone(), and blender::bke::bNodeTreeZone::input_node().
Referenced by get_references_coming_from_outside_zone(), and pass_left_to_right().
|
static |
Definition at line 867 of file node_tree_reference_lifetimes.cc.
References can_contain_reference(), can_contain_referenced_data(), blender::bits::foreach_1_index(), get_tree_relations(), blender::bits::BitGroupVector< InlineBufferCapacity, Allocator >::group_size(), GroupInputReferenceSet, GroupOutputData, LocalReferenceSet, blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::type, and blender::bNodeSocket::type.
Referenced by get_tree_relations(), and make_reference_lifetimes_info().
|
static |
Definition at line 99 of file node_tree_reference_lifetimes.cc.
References blender::bke::bNodeTreeZones::get_zone_by_node(), get_zone_of_node_if_full(), blender::bke::bNodeTreeZone::input_node_id, node, and blender::bke::bNodeTreeZone::output_node_id.
Referenced by get_zone_of_node_if_full(), pass_left_to_right(), and pass_right_to_left().
|
static |
Definition at line 983 of file node_tree_reference_lifetimes.cc.
References blender::bits::BitGroupVector< InlineBufferCapacity, Allocator >::all_bits(), blender::bke::node_tree_reference_lifetimes::bNodeTreeBitGroupVectorOptions::bNodeTreeBitGroupVectorOptions(), disable_unused_group_output_propagation(), find_reference_sets(), get_tree_relations(), make_reference_lifetimes_info(), blender::bke::node_tree_to_dot(), pass_left_to_right(), pass_right_to_left(), prepare_relations_by_node(), prepare_required_data_for_outputs(), set_initial_data_and_reference_bits(), and blender::Span< T >::size().
Referenced by analyse_reference_lifetimes(), and make_reference_lifetimes_info().
| std::ostream & blender::bke::node_tree_reference_lifetimes::operator<< | ( | std::ostream & | stream, |
| const ReferenceSetInfo & | info ) |
Definition at line 34 of file node_tree_reference_lifetimes.cc.
|
static |
Definition at line 78 of file node_tree_reference_lifetimes.cc.
References b, or_into_each_other(), and blender::bits::spans_equal().
Referenced by or_into_each_other(), and pass_right_to_left().
|
static |
Definition at line 66 of file node_tree_reference_lifetimes.cc.
References b, blender::bits::inplace_or_masked(), or_into_each_other_masked(), and blender::bits::spans_equal_masked().
Referenced by or_into_each_other_masked(), and pass_left_to_right().
|
static |
Definition at line 402 of file node_tree_reference_lifetimes.cc.
References GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT, GEO_NODE_REPEAT_OUTPUT, get_references_coming_from_outside_zone(), get_zone_of_node_if_full(), blender::bits::BitGroupVector< InlineBufferCapacity, Allocator >::group_size(), blender::IndexRange::IndexRange(), blender::bits::inplace_or_masked(), blender::bke::bNodeTreeZone::input_node(), node, NODE_CLOSURE_INPUT, NODE_CLOSURE_OUTPUT, NODE_EVALUATE_CLOSURE, or_into_each_other_masked(), blender::bke::bNodeTreeZone::output_node(), pass_left_to_right(), blender::SOCK_GEOMETRY, and storage.
Referenced by make_reference_lifetimes_info(), and pass_left_to_right().
|
static |
Definition at line 705 of file node_tree_reference_lifetimes.cc.
References GEO_NODE_FOREACH_GEOMETRY_ELEMENT_INPUT, GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT, GEO_NODE_REPEAT_INPUT, GEO_NODE_REPEAT_OUTPUT, get_zone_of_node_if_full(), blender::IndexRange::IndexRange(), node, NODE_CLOSURE_OUTPUT, or_into_each_other(), blender::bke::bNodeTreeZone::output_node(), pass_right_to_left(), blender::SOCK_GEOMETRY, blender::bNode::storage, and storage.
Referenced by make_reference_lifetimes_info(), and pass_right_to_left().
|
static |
Definition at line 115 of file node_tree_reference_lifetimes.cc.
References can_contain_referenced_data(), blender::ResourceScope::construct(), GEO_NODE_BAKE, GEO_NODE_REPEAT_INPUT, GEO_NODE_REPEAT_OUTPUT, GEO_NODE_SIMULATION_INPUT, GEO_NODE_SIMULATION_OUTPUT, blender::IndexRange::IndexRange(), node, NODE_CUSTOM_GROUP, NODE_GROUP, NODE_REROUTE, prepare_relations_by_node(), blender::SOCK_GEOMETRY, socket_may_have_reference(), and blender::bNodeSocket::type.
Referenced by make_reference_lifetimes_info(), and prepare_relations_by_node().
|
static |
Definition at line 638 of file node_tree_reference_lifetimes.cc.
References blender::BLI_assert(), can_contain_referenced_data(), ClosureOutputData, blender::bke::bNodeTreeZone::input_node_id, blender::MultiValueMap< Key, Value >::lookup(), NODE_CLOSURE_OUTPUT, blender::bke::bNodeTreeZone::output_node(), blender::bke::bNodeTreeZone::output_node_id, prepare_required_data_for_closure_outputs(), blender::Span< T >::size(), blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::type, blender::bNode::type_legacy, and blender::bke::bNodeTreeZones::zones.
Referenced by prepare_required_data_for_closure_outputs(), and prepare_required_data_for_outputs().
|
static |
Definition at line 605 of file node_tree_reference_lifetimes.cc.
References blender::BLI_assert(), can_contain_referenced_data(), blender::Span< T >::drop_back(), GroupOutputData, prepare_required_data_for_group_outputs(), blender::Span< T >::size(), and blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::type.
Referenced by prepare_required_data_for_group_outputs(), and prepare_required_data_for_outputs().
|
static |
Definition at line 682 of file node_tree_reference_lifetimes.cc.
References prepare_required_data_for_closure_outputs(), prepare_required_data_for_group_outputs(), and prepare_required_data_for_outputs().
Referenced by make_reference_lifetimes_info(), and prepare_required_data_for_outputs().
|
static |
Definition at line 345 of file node_tree_reference_lifetimes.cc.
References ClosureInputReferenceSet, ClosureOutputData, GroupInputReferenceSet, GroupOutputData, blender::Span< T >::index_range(), LocalReferenceSet, node, blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::potential_data_origins, set_initial_data_and_reference_bits(), and blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::type.
Referenced by make_reference_lifetimes_info(), and set_initial_data_and_reference_bits().
|
static |
Definition at line 61 of file node_tree_reference_lifetimes.cc.
References ELEM, blender::SOCK_BUNDLE, blender::SOCK_CLOSURE, blender::SOCK_GEOMETRY, socket_may_have_reference(), and blender::bNodeSocket::type.
Referenced by prepare_relations_by_node(), and socket_may_have_reference().