|
Blender V5.0
|
Classes | |
| struct | ReferenceSetInfo |
| struct | ReferenceLifetimesInfo |
| class | bNodeTreeBitGroupVectorOptions |
| class | NodeDeclaration |
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 aal::RelationsInNode * > | prepare_relations_by_node (const bNodeTree &tree, ResourceScope &scope) |
| static Vector< ReferenceSetInfo > | find_reference_sets (const bNodeTree &tree, const Span< const aal::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 aal::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 aal::RelationsInNode * > &relations_by_node, const BitGroupVector<> &potential_reference_by_socket, BitGroupVector<> &r_required_data_by_socket) |
| static aal::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 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 27 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 1072 of file node_tree_reference_lifetimes.cc.
References make_reference_lifetimes_info(), and tree.
| 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 83 of file node_tree_reference_lifetimes.cc.
References ELEM, SOCK_BUNDLE, SOCK_CLOSURE, and blender::nodes::socket_type_supports_fields().
Referenced by find_reference_sets(), get_tree_relations(), blender::nodes::node_geo_enable_output_cc::node_declare(), blender::nodes::node_geo_index_switch_cc::node_declare(), blender::nodes::node_geo_menu_switch_cc::node_declare(), blender::nodes::node_geo_switch_cc::node_declare(), and pass_right_to_left().
| 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 89 of file node_tree_reference_lifetimes.cc.
References ELEM, SOCK_BUNDLE, SOCK_CLOSURE, and SOCK_GEOMETRY.
Referenced by find_reference_sets(), get_tree_relations(), blender::nodes::node_geo_enable_output_cc::node_declare(), blender::nodes::node_geo_index_switch_cc::node_declare(), blender::nodes::node_geo_menu_switch_cc::node_declare(), blender::nodes::node_geo_switch_cc::node_declare(), prepare_relations_by_node(), prepare_required_data_for_closure_outputs(), and prepare_required_data_for_group_outputs().
|
static |
Definition at line 233 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, GroupInputReferenceSet, i, blender::Span< T >::index_range(), blender::bke::bNodeTreeZone::input_node(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::Vector< T, InlineBufferCapacity, Allocator >::last(), LocalReferenceSet, NODE_CLOSURE_OUTPUT, blender::bke::bNodeTreeZone::output_node(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), SOCK_CUSTOM, NodeEvaluateClosureOutputItem::socket_type, bNode::storage, tree, blender::bke::bNodeSocketType::type, bNodeSocket::type, bNode::type_legacy, and blender::bke::bNodeTreeZones::zones.
Referenced by make_reference_lifetimes_info().
|
static |
Definition at line 394 of file node_tree_reference_lifetimes.cc.
References blender::bke::bNodeTreeZone::border_links, bNodeLink::fromsock, and blender::bke::bNodeTreeZone::input_node().
Referenced by pass_left_to_right().
|
static |
Definition at line 905 of file node_tree_reference_lifetimes.cc.
References can_contain_reference(), can_contain_referenced_data(), blender::bits::foreach_1_index(), blender::bits::BitGroupVector< InlineBufferCapacity, Allocator >::group_size(), GroupInputReferenceSet, GroupOutputData, blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::index, LocalReferenceSet, tree, blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::type, and bNodeSocket::type.
Referenced by make_reference_lifetimes_info().
|
static |
Definition at line 94 of file node_tree_reference_lifetimes.cc.
References blender::bke::bNodeTreeZones::get_zone_by_node(), bNode::identifier, blender::bke::bNodeTreeZone::input_node_id, and blender::bke::bNodeTreeZone::output_node_id.
Referenced by pass_left_to_right(), and pass_right_to_left().
|
static |
Definition at line 996 of file node_tree_reference_lifetimes.cc.
References blender::bits::BitGroupVector< InlineBufferCapacity, Allocator >::all_bits(), find_reference_sets(), get_tree_relations(), 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(), blender::Span< T >::size(), and tree.
Referenced by analyse_reference_lifetimes().
| std::ostream & blender::bke::node_tree_reference_lifetimes::operator<< | ( | std::ostream & | stream, |
| const ReferenceSetInfo & | info ) |
Definition at line 29 of file node_tree_reference_lifetimes.cc.
|
static |
Definition at line 73 of file node_tree_reference_lifetimes.cc.
References b, and blender::bits::spans_equal().
Referenced by pass_right_to_left().
|
static |
Definition at line 61 of file node_tree_reference_lifetimes.cc.
References b, blender::bits::inplace_or_masked(), mask(), and blender::bits::spans_equal_masked().
Referenced by pass_left_to_right().
|
static |
Definition at line 418 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(), i, blender::bits::inplace_or_masked(), blender::bke::bNodeTreeZone::input_node(), NODE_CLOSURE_INPUT, NODE_CLOSURE_OUTPUT, NODE_EVALUATE_CLOSURE, or_into_each_other_masked(), blender::bke::bNodeTreeZone::output_node(), SOCK_GEOMETRY, and tree.
Referenced by make_reference_lifetimes_info().
|
static |
Definition at line 721 of file node_tree_reference_lifetimes.cc.
References can_contain_reference(), 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(), i, NODE_CLOSURE_OUTPUT, NODE_EVALUATE_CLOSURE, or_into_each_other(), blender::bke::bNodeTreeZone::output_node(), SOCK_GEOMETRY, bNode::storage, and tree.
Referenced by make_reference_lifetimes_info().
|
static |
Definition at line 110 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, i, NODE_CUSTOM_GROUP, NODE_GROUP, NODE_REROUTE, SOCK_GEOMETRY, socket_may_have_reference(), tree, and bNodeSocket::type.
Referenced by make_reference_lifetimes_info().
|
static |
Definition at line 654 of file node_tree_reference_lifetimes.cc.
References 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, blender::Span< T >::size(), blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::socket, tree, blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::type, bNode::type_legacy, and blender::bke::bNodeTreeZones::zones.
Referenced by prepare_required_data_for_outputs().
|
static |
Definition at line 621 of file node_tree_reference_lifetimes.cc.
References BLI_assert, can_contain_referenced_data(), blender::Span< T >::drop_back(), GroupOutputData, blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::index, blender::Span< T >::size(), tree, and blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::type.
Referenced by prepare_required_data_for_outputs().
|
static |
Definition at line 698 of file node_tree_reference_lifetimes.cc.
References prepare_required_data_for_closure_outputs(), prepare_required_data_for_group_outputs(), and tree.
Referenced by make_reference_lifetimes_info().
|
static |
Definition at line 361 of file node_tree_reference_lifetimes.cc.
References ClosureInputReferenceSet, ClosureOutputData, GroupInputReferenceSet, GroupOutputData, blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::index, blender::Span< T >::index_range(), LocalReferenceSet, blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::potential_data_origins, blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::socket, tree, and blender::bke::node_tree_reference_lifetimes::ReferenceSetInfo::type.
Referenced by make_reference_lifetimes_info().
|
static |
Definition at line 56 of file node_tree_reference_lifetimes.cc.
References ELEM, SOCK_BUNDLE, SOCK_CLOSURE, and bNodeSocket::type.
Referenced by prepare_relations_by_node().