diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2012-07-04 15:39:28 +0400 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2012-07-04 15:39:28 +0400 |
commit | 778999cbbf6d6430f6c8d75d8d9e2ea49fa8ace6 (patch) | |
tree | 0ece147a79e1e2249fa22ec28dcd60abf2d49b03 /source/blender/compositor/intern | |
parent | 33e12a298350d9aa684381a71a639864bf9bee3c (diff) |
Two pass execution:
1. first pass only fast nodes are calculated and only to the active
viewer node
2. second pass all nodes to all outputs
Temp disabled highlights because of random crashes.
Diffstat (limited to 'source/blender/compositor/intern')
9 files changed, 54 insertions, 11 deletions
diff --git a/source/blender/compositor/intern/COM_CompositorContext.cpp b/source/blender/compositor/intern/COM_CompositorContext.cpp index 56335630b80..fbdb4cd6b28 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.cpp +++ b/source/blender/compositor/intern/COM_CompositorContext.cpp @@ -30,6 +30,7 @@ CompositorContext::CompositorContext() this->m_quality = COM_QUALITY_HIGH; this->m_hasActiveOpenCLDevices = false; this->m_activegNode = NULL; + this->m_fastCalculation = false; } const int CompositorContext::getFramenumber() const diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index 49acda811f1..2f6abf39985 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -73,6 +73,11 @@ private: * @brief does this system have active opencl devices? */ bool m_hasActiveOpenCLDevices; + + /** + * @brief Skip slow nodes + */ + bool m_fastCalculation; public: /** @@ -148,6 +153,9 @@ public: int getChunksize() { return this->getbNodeTree()->chunksize; } const int isColorManaged() const; + + void setFastCalculation(bool fastCalculation) {this->m_fastCalculation = fastCalculation;} + bool isFastCalculation() {return this->m_fastCalculation;} }; diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp index 38c514d8e99..05fcfb33c51 100644 --- a/source/blender/compositor/intern/COM_Converter.cpp +++ b/source/blender/compositor/intern/COM_Converter.cpp @@ -117,7 +117,7 @@ #include "COM_ViewerNode.h" #include "COM_ZCombineNode.h" -Node *Converter::convert(bNode *b_node) +Node *Converter::convert(bNode *b_node, bool fast) { Node *node; @@ -125,6 +125,22 @@ Node *Converter::convert(bNode *b_node) node = new MuteNode(b_node); return node; } + if (fast) { + if (b_node->type == CMP_NODE_BLUR || + b_node->type == CMP_NODE_VECBLUR || + b_node->type == CMP_NODE_BILATERALBLUR || + b_node->type == CMP_NODE_DEFOCUS || + b_node->type == CMP_NODE_BOKEHBLUR || + b_node->type == CMP_NODE_GLARE || + b_node->type == CMP_NODE_DBLUR || + b_node->type == CMP_NODE_MOVIEDISTORTION || + b_node->type == CMP_NODE_LENSDIST || + b_node->type == CMP_NODE_DOUBLEEDGEMASK || + b_node->type == CMP_NODE_DILATEERODE) + { + return new MuteNode(b_node); + } + } switch (b_node->type) { case CMP_NODE_COMPOSITE: diff --git a/source/blender/compositor/intern/COM_Converter.h b/source/blender/compositor/intern/COM_Converter.h index dbe98871c50..15bda0839fa 100644 --- a/source/blender/compositor/intern/COM_Converter.h +++ b/source/blender/compositor/intern/COM_Converter.h @@ -42,7 +42,7 @@ public: * @see Node * @see MuteNode */ - static Node *convert(bNode *b_node); + static Node *convert(bNode *b_node, bool fast); /** * @brief This method will add a datetype conversion rule when the to-socket does not support the from-socket actual data type. diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp index 23e243187d5..ff841092848 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp @@ -44,9 +44,10 @@ #include "MEM_guardedalloc.h" #endif -ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering) +ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation) { this->m_context.setbNodeTree(editingtree); + this->m_context.setFastCalculation(fastcalculation); bNode *gnode; for (gnode = (bNode *)editingtree->nodes.first; gnode; gnode = (bNode *)gnode->next) { if (gnode->type == NODE_GROUP && gnode->typeinfo->group_edit_get(gnode)) { @@ -137,8 +138,10 @@ void ExecutionSystem::execute() WorkScheduler::start(this->m_context); executeGroups(COM_PRIORITY_HIGH); - executeGroups(COM_PRIORITY_MEDIUM); - executeGroups(COM_PRIORITY_LOW); + if (!this->getContext().isFastCalculation()) { + executeGroups(COM_PRIORITY_MEDIUM); + executeGroups(COM_PRIORITY_LOW); + } WorkScheduler::finish(); WorkScheduler::stop(); diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h index e51bd7f3026..209358ec786 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.h +++ b/source/blender/compositor/intern/COM_ExecutionSystem.h @@ -156,7 +156,7 @@ public: * @param editingtree [bNodeTree*] * @param rendering [true false] */ - ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering); + ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation); /** * Destructor diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp index 0f6ba1f4ac9..0abf7efdcfa 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp @@ -49,7 +49,7 @@ void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_star /* add all nodes of the tree to the node list */ bNode *node = (bNode *)tree->nodes.first; while (node != NULL) { - addNode(nodes, node, isActiveGroup); + addNode(nodes, node, isActiveGroup, system.getContext().isFastCalculation()); node = (bNode *)node->next; } @@ -77,11 +77,11 @@ void ExecutionSystemHelper::addNode(vector<Node *>& nodes, Node *node) nodes.push_back(node); } -Node *ExecutionSystemHelper::addNode(vector<Node *>& nodes, bNode *b_node, bool inActiveGroup) +Node *ExecutionSystemHelper::addNode(vector<Node *>& nodes, bNode *b_node, bool inActiveGroup, bool fast) { Converter converter; Node *node; - node = converter.convert(b_node); + node = converter.convert(b_node, fast); node->setIsInActiveGroup(inActiveGroup); if (node != NULL) { addNode(nodes, node); diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.h b/source/blender/compositor/intern/COM_ExecutionSystemHelper.h index 4b65ed15577..bd34fe8ab02 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.h +++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.h @@ -58,7 +58,7 @@ public: * @param bNode node to add * @return Node that represents the bNode or null when not able to convert. */ - static Node *addNode(vector<Node *>& nodes, bNode *b_node, bool isInActiveGroup); + static Node *addNode(vector<Node *>& nodes, bNode *b_node, bool isInActiveGroup, bool fast); /** * @brief Add a Node to a list diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp index 7282cf65bc3..9e48334bcca 100644 --- a/source/blender/compositor/intern/COM_compositor.cpp +++ b/source/blender/compositor/intern/COM_compositor.cpp @@ -57,8 +57,23 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering) /* set progress bar to 0% and status to init compositing*/ editingtree->progress(editingtree->prh, 0.0); + bool twopass = (editingtree->flag&NTREE_TWO_PASS) > 0 || rendering; /* initialize execution system */ - ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering); + if (twopass) { + ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, twopass); + system->execute(); + delete system; + + if (editingtree->test_break(editingtree->tbh)) { + // during editing multiple calls to this method can be triggered. + // make sure one the last one will be doing the work. + BLI_mutex_unlock(&compositorMutex); + return; + } + } + + + ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, false); system->execute(); delete system; |