Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/NOD_geometry_nodes_log.hh
| Show All 27 Lines | |||||||||||||
| #include "BLI_compute_context.hh" | #include "BLI_compute_context.hh" | ||||||||||||
| #include "BLI_enumerable_thread_specific.hh" | #include "BLI_enumerable_thread_specific.hh" | ||||||||||||
| #include "BLI_generic_pointer.hh" | #include "BLI_generic_pointer.hh" | ||||||||||||
| #include "BLI_multi_value_map.hh" | #include "BLI_multi_value_map.hh" | ||||||||||||
| #include "BKE_attribute.h" | #include "BKE_attribute.h" | ||||||||||||
| #include "BKE_geometry_set.hh" | #include "BKE_geometry_set.hh" | ||||||||||||
| #include "BKE_viewer_path.h" | |||||||||||||
| #include "FN_field.hh" | #include "FN_field.hh" | ||||||||||||
| #include "DNA_node_types.h" | #include "DNA_node_types.h" | ||||||||||||
| struct SpaceNode; | struct SpaceNode; | ||||||||||||
| struct SpaceSpreadsheet; | struct SpaceSpreadsheet; | ||||||||||||
| struct NodesModifierData; | struct NodesModifierData; | ||||||||||||
| ▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | |||||||||||||
| /** | /** | ||||||||||||
| * Data logged by a viewer node when it is executed. In this case, we do want to log the entire | * Data logged by a viewer node when it is executed. In this case, we do want to log the entire | ||||||||||||
| * geometry. | * geometry. | ||||||||||||
| */ | */ | ||||||||||||
| class ViewerNodeLog { | class ViewerNodeLog { | ||||||||||||
| public: | public: | ||||||||||||
| GeometrySet geometry; | GeometrySet geometry; | ||||||||||||
| GField field; | |||||||||||||
| }; | }; | ||||||||||||
| using Clock = std::chrono::steady_clock; | using Clock = std::chrono::steady_clock; | ||||||||||||
| using TimePoint = Clock::time_point; | using TimePoint = Clock::time_point; | ||||||||||||
| /** | /** | ||||||||||||
| * Logs all data for a specific geometry node tree in a specific context. When the same node group | * Logs all data for a specific geometry node tree in a specific context. When the same node group | ||||||||||||
| * is used in multiple times each instantiation will have a separate logger. | * is used in multiple times each instantiation will have a separate logger. | ||||||||||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | public: | ||||||||||||
| Vector<ViewerNodeLogWithNode, 0> viewer_node_logs; | Vector<ViewerNodeLogWithNode, 0> viewer_node_logs; | ||||||||||||
| Vector<AttributeUsageWithNode, 0> used_named_attributes; | Vector<AttributeUsageWithNode, 0> used_named_attributes; | ||||||||||||
| Vector<DebugMessage, 0> debug_messages; | Vector<DebugMessage, 0> debug_messages; | ||||||||||||
| GeoTreeLogger(); | GeoTreeLogger(); | ||||||||||||
| ~GeoTreeLogger(); | ~GeoTreeLogger(); | ||||||||||||
| void log_value(const bNode &node, const bNodeSocket &socket, GPointer value); | void log_value(const bNode &node, const bNodeSocket &socket, GPointer value); | ||||||||||||
| void log_viewer_node(const bNode &viewer_node, const GeometrySet &geometry, const GField &field); | void log_viewer_node(const bNode &viewer_node, GeometrySet geometry); | ||||||||||||
| }; | }; | ||||||||||||
| /** | /** | ||||||||||||
| * Contains data that has been logged for a specific node in a context. So when the node is in a | * Contains data that has been logged for a specific node in a context. So when the node is in a | ||||||||||||
| * node group that is used multiple times, there will be a different #GeoNodeLog for every | * node group that is used multiple times, there will be a different #GeoNodeLog for every | ||||||||||||
| * instance. | * instance. | ||||||||||||
| * | * | ||||||||||||
| * By default, not all of the info below is valid. A #GeoTreeLog::ensure_* method has to be called | * By default, not all of the info below is valid. A #GeoTreeLog::ensure_* method has to be called | ||||||||||||
| ▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | private: | ||||||||||||
| /** Container for all thread-local data. */ | /** Container for all thread-local data. */ | ||||||||||||
| threading::EnumerableThreadSpecific<LocalData> data_per_thread_; | threading::EnumerableThreadSpecific<LocalData> data_per_thread_; | ||||||||||||
| /** | /** | ||||||||||||
| * A #GeoTreeLog for every compute context. Those are created lazily when requested by UI code. | * A #GeoTreeLog for every compute context. Those are created lazily when requested by UI code. | ||||||||||||
| */ | */ | ||||||||||||
| Map<ComputeContextHash, std::unique_ptr<GeoTreeLog>> tree_logs_; | Map<ComputeContextHash, std::unique_ptr<GeoTreeLog>> tree_logs_; | ||||||||||||
| public: | public: | ||||||||||||
HooglyBooglyUnsubmitted Done Inline Actions
HooglyBoogly: | |||||||||||||
| GeoModifierLog(); | GeoModifierLog(); | ||||||||||||
| ~GeoModifierLog(); | ~GeoModifierLog(); | ||||||||||||
| /** | /** | ||||||||||||
| * Get a thread-local logger for the current node tree. | * Get a thread-local logger for the current node tree. | ||||||||||||
| */ | */ | ||||||||||||
| GeoTreeLogger &get_local_tree_logger(const ComputeContext &compute_context); | GeoTreeLogger &get_local_tree_logger(const ComputeContext &compute_context); | ||||||||||||
| /** | /** | ||||||||||||
| * Get a log a specific node tree instance. | * Get a log a specific node tree instance. | ||||||||||||
| */ | */ | ||||||||||||
| GeoTreeLog &get_tree_log(const ComputeContextHash &compute_context_hash); | GeoTreeLog &get_tree_log(const ComputeContextHash &compute_context_hash); | ||||||||||||
| /** | /** | ||||||||||||
| * Utility accessor to logged data. | * Utility accessor to logged data. | ||||||||||||
| */ | */ | ||||||||||||
| static GeoTreeLog *get_tree_log_for_node_editor(const SpaceNode &snode); | static GeoTreeLog *get_tree_log_for_node_editor(const SpaceNode &snode); | ||||||||||||
| static const ViewerNodeLog *find_viewer_node_log_for_spreadsheet( | static const ViewerNodeLog *find_viewer_node_log_for_path(const ViewerPath &viewer_path); | ||||||||||||
| const SpaceSpreadsheet &sspreadsheet); | |||||||||||||
| }; | }; | ||||||||||||
| } // namespace blender::nodes::geo_eval_log | } // namespace blender::nodes::geo_eval_log | ||||||||||||