Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/intern/COM_Debug.h
| Show All 23 Lines | |||||
| #include "COM_ExecutionSystem.h" | #include "COM_ExecutionSystem.h" | ||||
| #include "COM_NodeOperation.h" | #include "COM_NodeOperation.h" | ||||
| #include "COM_defines.h" | #include "COM_defines.h" | ||||
| namespace blender::compositor { | namespace blender::compositor { | ||||
| static constexpr bool COM_EXPORT_GRAPHVIZ = false; | static constexpr bool COM_EXPORT_GRAPHVIZ = false; | ||||
| static constexpr bool COM_GRAPHVIZ_SHOW_NODE_NAME = false; | static constexpr bool COM_GRAPHVIZ_SHOW_NODE_NAME = false; | ||||
jbakker: COM_EXPORT_OPERATION_BUFFERS | |||||
| /* Saves operations results to image files. */ | |||||
| static constexpr bool COM_EXPORT_OPERATION_BUFFERS = false; | |||||
| class Node; | class Node; | ||||
| class ExecutionSystem; | class ExecutionSystem; | ||||
| class ExecutionGroup; | class ExecutionGroup; | ||||
| class DebugInfo { | class DebugInfo { | ||||
| public: | public: | ||||
| typedef enum { EG_WAIT, EG_RUNNING, EG_FINISHED } GroupState; | typedef enum { EG_WAIT, EG_RUNNING, EG_FINISHED } GroupState; | ||||
| Show All 29 Lines | public: | ||||
| { | { | ||||
| if (COM_EXPORT_GRAPHVIZ) { | if (COM_EXPORT_GRAPHVIZ) { | ||||
| m_file_index = 1; | m_file_index = 1; | ||||
| m_group_states.clear(); | m_group_states.clear(); | ||||
| for (ExecutionGroup *execution_group : system->m_groups) { | for (ExecutionGroup *execution_group : system->m_groups) { | ||||
| m_group_states[execution_group] = EG_WAIT; | m_group_states[execution_group] = EG_WAIT; | ||||
| } | } | ||||
| } | } | ||||
| if (COM_EXPORT_OPERATION_BUFFERS) { | |||||
| delete_operation_exports(); | |||||
| } | |||||
| }; | }; | ||||
| static void node_added(const Node *node) | static void node_added(const Node *node) | ||||
| { | { | ||||
| if (COM_EXPORT_GRAPHVIZ) { | if (COM_EXPORT_GRAPHVIZ) { | ||||
| m_node_names[node] = std::string(node->getbNode() ? node->getbNode()->name : ""); | m_node_names[node] = std::string(node->getbNode() ? node->getbNode()->name : ""); | ||||
| } | } | ||||
| } | } | ||||
| Show All 27 Lines | public: | ||||
| }; | }; | ||||
| static void execution_group_finished(const ExecutionGroup *group) | static void execution_group_finished(const ExecutionGroup *group) | ||||
| { | { | ||||
| if (COM_EXPORT_GRAPHVIZ) { | if (COM_EXPORT_GRAPHVIZ) { | ||||
| m_group_states[group] = EG_FINISHED; | m_group_states[group] = EG_FINISHED; | ||||
| } | } | ||||
| }; | }; | ||||
| static void operation_rendered(const NodeOperation *op, MemoryBuffer *render) | |||||
| { | |||||
| /* Don't export constant operations as there are too many and it's rarely useful. */ | |||||
| if (COM_EXPORT_OPERATION_BUFFERS && render && !render->is_a_single_elem()) { | |||||
| export_operation(op, render); | |||||
| } | |||||
| } | |||||
| static void graphviz(const ExecutionSystem *system, StringRefNull name = ""); | static void graphviz(const ExecutionSystem *system, StringRefNull name = ""); | ||||
| protected: | protected: | ||||
| static int graphviz_operation(const ExecutionSystem *system, | static int graphviz_operation(const ExecutionSystem *system, | ||||
| NodeOperation *operation, | NodeOperation *operation, | ||||
| const ExecutionGroup *group, | const ExecutionGroup *group, | ||||
| char *str, | char *str, | ||||
| int maxlen); | int maxlen); | ||||
| static int graphviz_legend_color(const char *name, const char *color, char *str, int maxlen); | static int graphviz_legend_color(const char *name, const char *color, char *str, int maxlen); | ||||
| static int graphviz_legend_line( | static int graphviz_legend_line( | ||||
| const char *name, const char *color, const char *style, char *str, int maxlen); | const char *name, const char *color, const char *style, char *str, int maxlen); | ||||
| static int graphviz_legend_group( | static int graphviz_legend_group( | ||||
| const char *name, const char *color, const char *style, char *str, int maxlen); | const char *name, const char *color, const char *style, char *str, int maxlen); | ||||
| static int graphviz_legend(char *str, int maxlen, bool has_execution_groups); | static int graphviz_legend(char *str, int maxlen, bool has_execution_groups); | ||||
| static bool graphviz_system(const ExecutionSystem *system, char *str, int maxlen); | static bool graphviz_system(const ExecutionSystem *system, char *str, int maxlen); | ||||
| static void export_operation(const NodeOperation *op, MemoryBuffer *render); | |||||
| static void delete_operation_exports(); | |||||
| }; | }; | ||||
| } // namespace blender::compositor | } // namespace blender::compositor | ||||
COM_EXPORT_OPERATION_BUFFERS