diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-02-17 13:48:54 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-02-17 13:53:52 +0400 |
commit | 7ee9de29a623cfb2a1efa70eb93e5b18bb8ed144 (patch) | |
tree | 94291c8172da48bc280161561217a00d3773984d /source/blender/compositor/intern | |
parent | dbd37b21bd5e87533b690e459a130d096972ffb3 (diff) |
Fix T38487: Wrapped translate node in combination with other buffered
nodes (Blur) causes crash due to chained read/write buffer operations.
The way read/write buffer operations are created for both the wrapped
translate node and then the "complex" blur node creates a chain of
buffers in the same ExecutionGroup. This leaves the later write buffer
operations without a proper "executor" group and fails on assert.
Solution for now is to check for existing output buffer operations like
it already happens for inputs. This is extremely ugly code, but should
become a lot more transparent after compositor cleanup ({D309}).
Diffstat (limited to 'source/blender/compositor/intern')
-rw-r--r-- | source/blender/compositor/intern/COM_ExecutionSystem.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp index 6a208001f46..088232481d0 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp @@ -241,14 +241,34 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation) */ OutputSocket *outputsocket = operation->getOutputSocket(); if (outputsocket->isConnected()) { - WriteBufferOperation *writeOperation; - writeOperation = new WriteBufferOperation(); - writeOperation->setbNodeTree(this->getContext().getbNodeTree()); - this->addOperation(writeOperation); - ExecutionSystemHelper::addLink(this->getConnections(), outputsocket, writeOperation->getInputSocket(0)); + WriteBufferOperation *writeOperation = NULL; + /* try to find existing write buffer operation first */ + for (index = 0; index < outputsocket->getNumberOfConnections(); index++) { + SocketConnection *connection = outputsocket->getConnection(index); + NodeBase *otherEnd = connection->getToNode(); + if (otherEnd->isOperation()) { + NodeOperation *otherEndOp = (NodeOperation *)otherEnd; + if (otherEndOp->isWriteBufferOperation()) { + writeOperation = (WriteBufferOperation *)otherEndOp; + break; + } + } + } + /* if no write buffer operation exists yet, create a new one */ + if (!writeOperation) { + writeOperation = new WriteBufferOperation(); + writeOperation->setbNodeTree(this->getContext().getbNodeTree()); + this->addOperation(writeOperation); + ExecutionSystemHelper::addLink(this->getConnections(), outputsocket, writeOperation->getInputSocket(0)); + } writeOperation->readResolutionFromInputSocket(); - for (index = 0; index < outputsocket->getNumberOfConnections() - 1; index++) { + + for (index = 0; index < outputsocket->getNumberOfConnections(); index++) { SocketConnection *connection = outputsocket->getConnection(index); + /* skip existing connections to write buffer operation */ + if (connection->getToNode() == writeOperation) + continue; + ReadBufferOperation *readoperation = new ReadBufferOperation(); readoperation->setMemoryProxy(writeOperation->getMemoryProxy()); connection->setFromSocket(readoperation->getOutputSocket()); |