From fdd889717239e8dbc7b3dabf1e3c630d6203837b Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Fri, 13 Sep 2013 13:36:47 +0000 Subject: Cleanup and improvements of the compositor debug output. Debug code for graphviz output moved to a dedicated file COM_Debug.h/cpp. The DebugInfo class has only static functions, which are called from a number of places to keep track of what is happening in the compositor. If debugging is disabled these are just inline stubs, so we don't need #ifdefs everywhere and don't get any overhead. The graphviz output is much more useful now. DebugInfo keeps track of node names in a static string map for meaningful names. It uses a number of colors for various special operation classes. ExecutionGroups are indicated in graphviz with clusters. Currently the graphviz .dot files are stored in the BLI_temporary_dir() folder. A separate dot file is generated for each stage of the ExecutionGroup scheduling, this is intended to give some idea of the compositor progress, but could still be improved. --- .../intern/COM_ExecutionSystemHelper.cpp | 147 +-------------------- 1 file changed, 3 insertions(+), 144 deletions(-) (limited to 'source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp') diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp index 9024cd33745..9516deee7e3 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp @@ -22,9 +22,6 @@ #include "COM_ExecutionSystemHelper.h" -#include -#include - #include "PIL_time.h" #include "COM_Converter.h" @@ -37,6 +34,7 @@ #include "COM_WriteBufferOperation.h" #include "COM_ReadBufferOperation.h" #include "COM_ViewerOperation.h" +#include "COM_Debug.h" extern "C" { #include "BKE_node.h" @@ -93,6 +91,8 @@ Node *ExecutionSystemHelper::addNode(vector& nodes, bNode *b_node, bool if (node) { node->setIsInActiveGroup(inActiveGroup); addNode(nodes, node); + + DebugInfo::node_added(node); } return node; } @@ -166,144 +166,3 @@ SocketConnection *ExecutionSystemHelper::addLink(vector& lin links.push_back(newconnection); return newconnection; } - -void ExecutionSystemHelper::debugDump(ExecutionSystem *system) -{ - Node *node; - NodeOperation *operation; - ExecutionGroup *group; - SocketConnection *connection; - int tot, tot2; - printf("-- BEGIN COMPOSITOR DUMP --\r\n"); - printf("digraph compositorexecution {\r\n"); - tot = system->getNodes().size(); - for (int i = 0; i < tot; i++) { - node = system->getNodes()[i]; - printf("// NODE: %s\r\n", node->getbNode()->typeinfo->ui_name); - } - tot = system->getOperations().size(); - for (int i = 0; i < tot; i++) { - operation = system->getOperations()[i]; - printf("// OPERATION: %p\r\n", operation); - printf("\t\"O_%p\"", operation); - printf(" [shape=record,label=\"{"); - tot2 = operation->getNumberOfInputSockets(); - if (tot2 != 0) { - printf("{"); - for (int j = 0; j < tot2; j++) { - InputSocket *socket = operation->getInputSocket(j); - if (j != 0) { - printf("|"); - } - printf("", socket); - switch (socket->getDataType()) { - case COM_DT_VALUE: - printf("Value"); - break; - case COM_DT_VECTOR: - printf("Vector"); - break; - case COM_DT_COLOR: - printf("Color"); - break; - } - } - printf("}"); - printf("|"); - } - if (operation->isViewerOperation()) { - ViewerOperation *viewer = (ViewerOperation *)operation; - if (viewer->isActiveViewerOutput()) { - printf("Active viewer"); - } - else { - printf("Viewer"); - } - } - else if (operation->isOutputOperation(system->getContext().isRendering())) { - printf("Output"); - } - else if (operation->isSetOperation()) { - printf("Set"); - } - else if (operation->isReadBufferOperation()) { - printf("ReadBuffer"); - } - else if (operation->isWriteBufferOperation()) { - printf("WriteBuffer"); - } - else { - printf("O_%p", operation); - } - printf(" (%d,%d)", operation->getWidth(), operation->getHeight()); - tot2 = operation->getNumberOfOutputSockets(); - if (tot2 != 0) { - printf("|"); - printf("{"); - for (int j = 0; j < tot2; j++) { - OutputSocket *socket = operation->getOutputSocket(j); - if (j != 0) { - printf("|"); - } - printf("", socket); - switch (socket->getDataType()) { - case COM_DT_VALUE: - printf("Value"); - break; - case COM_DT_VECTOR: - printf("Vector"); - break; - case COM_DT_COLOR: - printf("Color"); - break; - } - } - printf("}"); - } - printf("}\"]"); - printf("\r\n"); - } - tot = system->getExecutionGroups().size(); - for (int i = 0; i < tot; i++) { - group = system->getExecutionGroups()[i]; - printf("// GROUP: %d\r\n", i); - printf("subgraph {\r\n"); - printf("// OUTPUTOPERATION: %p\r\n", group->getOutputNodeOperation()); - printf(" O_%p\r\n", group->getOutputNodeOperation()); - printf("}\r\n"); - } - tot = system->getOperations().size(); - for (int i = 0; i < tot; i++) { - operation = system->getOperations()[i]; - if (operation->isReadBufferOperation()) { - ReadBufferOperation *read = (ReadBufferOperation *)operation; - WriteBufferOperation *write = read->getMemoryProxy()->getWriteBufferOperation(); - printf("\t\"O_%p\" -> \"O_%p\" [style=dotted]\r\n", write, read); - } - } - tot = system->getConnections().size(); - for (int i = 0; i < tot; i++) { - connection = system->getConnections()[i]; - printf("// CONNECTION: %p.%p -> %p.%p\r\n", connection->getFromNode(), connection->getFromSocket(), connection->getToNode(), connection->getToSocket()); - printf("\t\"O_%p\":\"OUT_%p\" -> \"O_%p\":\"IN_%p\"", connection->getFromNode(), connection->getFromSocket(), connection->getToNode(), connection->getToSocket()); - if (!connection->isValid()) { - printf(" [color=red]"); - } - else { - switch (connection->getFromSocket()->getDataType()) { - case COM_DT_VALUE: - printf(" [color=grey]"); - break; - case COM_DT_VECTOR: - printf(" [color=blue]"); - break; - case COM_DT_COLOR: - printf(" [color=orange]"); - break; - } - } - printf("\r\n"); - } - printf("}\r\n"); - printf("-- END COMPOSITOR DUMP --\r\n"); -} -- cgit v1.2.3