Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/compositor/intern')
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrder.h2
-rw-r--r--source/blender/compositor/intern/COM_CompositorContext.h4
-rw-r--r--source/blender/compositor/intern/COM_Converter.cpp4
-rw-r--r--source/blender/compositor/intern/COM_Converter.h6
-rw-r--r--source/blender/compositor/intern/COM_Debug.cpp66
-rw-r--r--source/blender/compositor/intern/COM_Debug.h16
-rw-r--r--source/blender/compositor/intern/COM_Device.h4
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cpp14
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.h80
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp2
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.h4
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.h44
-rw-r--r--source/blender/compositor/intern/COM_MemoryProxy.h8
-rw-r--r--source/blender/compositor/intern/COM_Node.cpp6
-rw-r--r--source/blender/compositor/intern/COM_Node.h52
-rw-r--r--source/blender/compositor/intern/COM_NodeConverter.cpp26
-rw-r--r--source/blender/compositor/intern/COM_NodeConverter.h24
-rw-r--r--source/blender/compositor/intern/COM_NodeGraph.cpp36
-rw-r--r--source/blender/compositor/intern/COM_NodeGraph.h34
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.cpp2
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.h54
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.cpp160
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.h50
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.cpp4
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.h14
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedOperation.cpp2
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedOperation.h10
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.cpp6
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.h2
-rw-r--r--source/blender/compositor/intern/COM_compositor.cpp2
30 files changed, 369 insertions, 369 deletions
diff --git a/source/blender/compositor/intern/COM_ChunkOrder.h b/source/blender/compositor/intern/COM_ChunkOrder.h
index 0310933e5c5..4728b771e3c 100644
--- a/source/blender/compositor/intern/COM_ChunkOrder.h
+++ b/source/blender/compositor/intern/COM_ChunkOrder.h
@@ -34,7 +34,7 @@ public:
ChunkOrder();
void determineDistance(ChunkOrderHotspot **hotspots, unsigned int numberOfHotspots);
friend bool operator<(const ChunkOrder &a, const ChunkOrder &b);
-
+
void setChunkNumber(unsigned int chunknumber) { this->m_number = chunknumber; }
void setX(int x) { this->m_x = x; }
void setY(int y) { this->m_y = y; }
diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h
index d58e8502414..1c702503915 100644
--- a/source/blender/compositor/intern/COM_CompositorContext.h
+++ b/source/blender/compositor/intern/COM_CompositorContext.h
@@ -126,7 +126,7 @@ public:
* @brief get the scene of the context
*/
const RenderData *getRenderData() const { return this->m_rd; }
-
+
void setScene(Scene *scene) { m_scene = scene; }
Scene *getScene() const { return m_scene; }
@@ -196,7 +196,7 @@ public:
void setViewName(const char *viewName) { this->m_viewName = viewName; }
int getChunksize() const { return this->getbNodeTree()->chunksize; }
-
+
void setFastCalculation(bool fastCalculation) {this->m_fastCalculation = fastCalculation;}
bool isFastCalculation() const { return this->m_fastCalculation; }
bool isGroupnodeBufferEnabled() const { return (this->getbNodeTree()->flag & NTREE_COM_GROUPNODE_BUFFER) != 0; }
diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index 3d49443c146..58e0da04e5e 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -414,7 +414,7 @@ NodeOperation *Converter::convertDataType(NodeOperationOutput *from, NodeOperati
{
DataType fromDatatype = from->getDataType();
DataType toDatatype = to->getDataType();
-
+
if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_COLOR) {
return new ConvertValueToColorOperation();
}
@@ -433,7 +433,7 @@ NodeOperation *Converter::convertDataType(NodeOperationOutput *from, NodeOperati
else if (fromDatatype == COM_DT_VECTOR && toDatatype == COM_DT_COLOR) {
return new ConvertVectorToColorOperation();
}
-
+
return NULL;
}
diff --git a/source/blender/compositor/intern/COM_Converter.h b/source/blender/compositor/intern/COM_Converter.h
index 7ed5616d899..b57220351e8 100644
--- a/source/blender/compositor/intern/COM_Converter.h
+++ b/source/blender/compositor/intern/COM_Converter.h
@@ -50,14 +50,14 @@ public:
* @see Node
*/
static Node *convert(bNode *b_node);
-
+
/**
* @brief True if the node is considered 'fast'.
*
* Slow nodes will be skipped if fast execution is required.
*/
static bool is_fast_node(bNode *b_node);
-
+
/**
* @brief This method will add a datetype conversion rule when the to-socket does not support the from-socket actual data type.
*
@@ -68,7 +68,7 @@ public:
* @see NodeLink - a link between two sockets
*/
static NodeOperation *convertDataType(NodeOperationOutput *from, NodeOperationInput *to);
-
+
/**
* @brief This method will add a resolution rule based on the settings of the NodeInput.
*
diff --git a/source/blender/compositor/intern/COM_Debug.cpp b/source/blender/compositor/intern/COM_Debug.cpp
index b95b7500cca..6179bd26275 100644
--- a/source/blender/compositor/intern/COM_Debug.cpp
+++ b/source/blender/compositor/intern/COM_Debug.cpp
@@ -118,7 +118,7 @@ void DebugInfo::execution_group_finished(const ExecutionGroup *group)
int DebugInfo::graphviz_operation(const ExecutionSystem *system, const NodeOperation *operation, const ExecutionGroup *group, char *str, int maxlen)
{
int len = 0;
-
+
std::string fillcolor = "gainsboro";
if (operation->isViewerOperation()) {
const ViewerOperation *viewer = (const ViewerOperation *)operation;
@@ -141,14 +141,14 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system, const NodeOpera
else if (operation->isWriteBufferOperation()) {
fillcolor = "darkorange";
}
-
+
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// OPERATION: %p\r\n", operation);
if (group)
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\"O_%p_%p\"", operation, group);
else
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\"O_%p\"", operation);
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, " [fillcolor=%s,style=filled,shape=record,label=\"{", fillcolor.c_str());
-
+
int totinputs = operation->getNumberOfInputSockets();
if (totinputs != 0) {
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "{");
@@ -173,11 +173,11 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system, const NodeOpera
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "}");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|");
}
-
+
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "%s\\n(%s)", m_op_names[operation].c_str(), typeid(*operation).name());
-
+
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, " (%u,%u)", operation->getWidth(), operation->getHeight());
-
+
int totoutputs = operation->getNumberOfOutputSockets();
if (totoutputs != 0) {
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|");
@@ -204,7 +204,7 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system, const NodeOpera
}
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "}\"]");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\r\n");
-
+
return len;
}
@@ -233,7 +233,7 @@ int DebugInfo::graphviz_legend_group(const char *name, const char *color, const
int DebugInfo::graphviz_legend(char *str, int maxlen)
{
int len = 0;
-
+
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "{\r\n");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "rank = sink;\r\n");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Legend [shape=none, margin=0, label=<\r\n");
@@ -266,12 +266,12 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
{
char strbuf[64];
int len = 0;
-
+
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "digraph compositorexecution {\r\n");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "ranksep=1.5\r\n");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "rankdir=LR\r\n");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "splines=false\r\n");
-
+
#if 0
for (ExecutionSystem::Operations::const_iterator it = system->m_operations.begin();
it != system->m_operations.end(); ++it) {
@@ -279,13 +279,13 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// OPERATION: %s\r\n", node->getbNode()->typeinfo->ui_name);
}
#endif
-
+
int totops = system->m_operations.size();
int totgroups = system->m_groups.size();
std::map<NodeOperation *, std::vector<std::string> > op_groups;
for (int i = 0; i < totgroups; ++i) {
const ExecutionGroup *group = system->m_groups[i];
-
+
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// GROUP: %d\r\n", i);
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "subgraph cluster_%d{\r\n", i);
/* used as a check for executing group */
@@ -302,41 +302,41 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "color=black\r\n");
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "fillcolor=chartreuse4\r\n");
}
-
+
for (ExecutionGroup::Operations::const_iterator it = group->m_operations.begin(); it != group->m_operations.end(); ++it) {
NodeOperation *operation = *it;
-
+
sprintf(strbuf, "_%p", group);
op_groups[operation].push_back(std::string(strbuf));
-
+
len += graphviz_operation(system, operation, group, str + len, maxlen > len ? maxlen - len : 0);
}
-
+
// len += snprintf(str+len, maxlen>len ? maxlen-len : 0, "// OUTPUTOPERATION: %p\r\n", group->getOutputOperation());
// len += snprintf(str+len, maxlen>len ? maxlen-len : 0, " O_%p\r\n", group->getOutputOperation());
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "}\r\n");
}
-
+
/* operations not included in any group */
for (int j = 0; j < totops; ++j) {
NodeOperation *operation = system->m_operations[j];
if (op_groups.find(operation) != op_groups.end())
continue;
-
+
op_groups[operation].push_back(std::string(""));
-
+
len += graphviz_operation(system, operation, 0, str + len, maxlen > len ? maxlen - len : 0);
}
-
+
for (int i = 0; i < totops; i++) {
NodeOperation *operation = system->m_operations[i];
-
+
if (operation->isReadBufferOperation()) {
ReadBufferOperation *read = (ReadBufferOperation *)operation;
WriteBufferOperation *write = read->getMemoryProxy()->getWriteBufferOperation();
std::vector<std::string> &read_groups = op_groups[read];
std::vector<std::string> &write_groups = op_groups[write];
-
+
for (int k = 0; k < write_groups.size(); ++k) {
for (int l = 0; l < read_groups.size(); ++l) {
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\"O_%p%s\" -> \"O_%p%s\" [style=dotted]\r\n", write, write_groups[k].c_str(), read, read_groups[l].c_str());
@@ -344,17 +344,17 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
}
}
}
-
+
for (int i = 0; i < totops; i++) {
NodeOperation *op = system->m_operations[i];
-
+
for (NodeOperation::Inputs::const_iterator it = op->m_inputs.begin(); it != op->m_inputs.end(); ++it) {
NodeOperationInput *to = *it;
NodeOperationOutput *from = to->getLink();
-
+
if (!from)
continue;
-
+
std::string color;
switch (from->getDataType()) {
case COM_DT_VALUE:
@@ -367,12 +367,12 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
color = "orange";
break;
}
-
+
NodeOperation *to_op = &to->getOperation();
NodeOperation *from_op = &from->getOperation();
std::vector<std::string> &from_groups = op_groups[from_op];
std::vector<std::string> &to_groups = op_groups[to_op];
-
+
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// CONNECTION: %p.%p -> %p.%p\r\n",
from_op, from, to_op, to);
for (int k = 0; k < from_groups.size(); ++k) {
@@ -385,11 +385,11 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
}
}
}
-
+
len += graphviz_legend(str + len, maxlen > len ? maxlen - len : 0);
-
+
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "}\r\n");
-
+
return (len < maxlen);
}
@@ -399,11 +399,11 @@ void DebugInfo::graphviz(const ExecutionSystem *system)
if (graphviz_system(system, str, sizeof(str) - 1)) {
char basename[FILE_MAX];
char filename[FILE_MAX];
-
+
BLI_snprintf(basename, sizeof(basename), "compositor_%d.dot", m_file_index);
BLI_join_dirfile(filename, sizeof(filename), BKE_tempdir_session(), basename);
++m_file_index;
-
+
FILE *fp = BLI_fopen(filename, "wb");
fputs(str, fp);
fclose(fp);
diff --git a/source/blender/compositor/intern/COM_Debug.h b/source/blender/compositor/intern/COM_Debug.h
index 4b4894d36cf..f5db93e8825 100644
--- a/source/blender/compositor/intern/COM_Debug.h
+++ b/source/blender/compositor/intern/COM_Debug.h
@@ -39,27 +39,27 @@ public:
EG_RUNNING,
EG_FINISHED
} GroupState;
-
+
typedef std::map<const Node *, std::string> NodeNameMap;
typedef std::map<const NodeOperation *, std::string> OpNameMap;
typedef std::map<const ExecutionGroup *, GroupState> GroupStateMap;
-
+
static std::string node_name(const Node *node);
static std::string operation_name(const NodeOperation *op);
-
+
static void convert_started();
static void execute_started(const ExecutionSystem *system);
-
+
static void node_added(const Node *node);
static void node_to_operations(const Node *node);
static void operation_added(const NodeOperation *operation);
static void operation_read_write_buffer(const NodeOperation *operation);
-
+
static void execution_group_started(const ExecutionGroup *group);
static void execution_group_finished(const ExecutionGroup *group);
-
+
static void graphviz(const ExecutionSystem *system);
-
+
#ifdef COM_DEBUG
protected:
static int graphviz_operation(const ExecutionSystem *system, const NodeOperation *operation, const ExecutionGroup *group, char *str, int maxlen);
@@ -68,7 +68,7 @@ protected:
static int graphviz_legend_group(const char *name, const char *color, const char *style, char *str, int maxlen);
static int graphviz_legend(char *str, int maxlen);
static bool graphviz_system(const ExecutionSystem *system, char *str, int maxlen);
-
+
private:
static int m_file_index;
static NodeNameMap m_node_names; /**< map nodes to usable names for debug output */
diff --git a/source/blender/compositor/intern/COM_Device.h b/source/blender/compositor/intern/COM_Device.h
index 62653357fdf..4ab6e1e2f96 100644
--- a/source/blender/compositor/intern/COM_Device.h
+++ b/source/blender/compositor/intern/COM_Device.h
@@ -34,11 +34,11 @@ class Device {
public:
/**
- * @brief Declaration of the virtual destructor
+ * @brief Declaration of the virtual destructor
* @note resolve warning gcc 4.7
*/
virtual ~Device() {}
-
+
/**
* @brief initialize the device
*/
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index 8a8193bcb62..5a651f07868 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -73,16 +73,16 @@ CompositorPriority ExecutionGroup::getRenderPriotrity()
bool ExecutionGroup::canContainOperation(NodeOperation *operation)
{
if (!this->m_initialized) { return true; }
-
+
if (operation->isReadBufferOperation()) { return true; }
if (operation->isWriteBufferOperation()) { return false; }
if (operation->isSetOperation()) { return true; }
-
+
/* complex groups don't allow further ops (except read buffer and values, see above) */
if (m_complex) { return false; }
/* complex ops can't be added to other groups (except their own, which they initialize, see above) */
if (operation->isComplex()) { return false; }
-
+
return true;
}
@@ -90,16 +90,16 @@ bool ExecutionGroup::addOperation(NodeOperation *operation)
{
if (!canContainOperation(operation))
return false;
-
+
if (!operation->isReadBufferOperation() && !operation->isWriteBufferOperation()) {
m_complex = operation->isComplex();
m_openCL = operation->isOpenCL();
m_singleThreaded = operation->isSingleThreaded();
m_initialized = true;
}
-
+
m_operations.push_back(operation);
-
+
return true;
}
@@ -382,7 +382,7 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo
{
if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED)
this->m_chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED;
-
+
atomic_add_and_fetch_u(&this->m_chunksFinished, 1);
if (memoryBuffers) {
for (unsigned int index = 0; index < this->m_cachedMaxReadBufferOffset; index++) {
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h
index 0f84dccb711..20ffbeaa357 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.h
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.h
@@ -65,89 +65,89 @@ typedef enum ChunkExecutionState {
class ExecutionGroup {
public:
typedef std::vector<NodeOperation*> Operations;
-
+
private:
// fields
-
+
/**
* @brief list of operations in this ExecutionGroup
*/
Operations m_operations;
-
+
/**
* @brief is this ExecutionGroup an input ExecutionGroup
* an input execution group is a group that is at the end of the calculation (the output is important for the user)
*/
int m_isOutput;
-
+
/**
* @brief Width of the output
*/
unsigned int m_width;
-
+
/**
* @brief Height of the output
*/
unsigned int m_height;
-
+
/**
* @brief size of a single chunk, being Width or of height
* a chunk is always a square, except at the edges of the MemoryBuffer
*/
unsigned int m_chunkSize;
-
+
/**
* @brief number of chunks in the x-axis
*/
unsigned int m_numberOfXChunks;
-
+
/**
* @brief number of chunks in the y-axis
*/
unsigned int m_numberOfYChunks;
-
+
/**
* @brief total number of chunks
*/
unsigned int m_numberOfChunks;
-
+
/**
* @brief contains this ExecutionGroup a complex NodeOperation.
*/
bool m_complex;
-
+
/**
* @brief can this ExecutionGroup be scheduled on an OpenCLDevice
*/
bool m_openCL;
-
+
/**
* @brief Is this Execution group SingleThreaded
*/
bool m_singleThreaded;
-
+
/**
* @brief what is the maximum number field of all ReadBufferOperation in this ExecutionGroup.
* @note this is used to construct the MemoryBuffers that will be passed during execution.
*/
unsigned int m_cachedMaxReadBufferOffset;
-
+
/**
* @brief a cached vector of all read operations in the execution group.
*/
Operations m_cachedReadOperations;
-
+
/**
* @brief reference to the original bNodeTree, this field is only set for the 'top' execution group.
* @note can only be used to call the callbacks for progress, status and break
*/
const bNodeTree *m_bTree;
-
+
/**
* @brief total number of chunks that have been calculated for this ExecutionGroup
*/
unsigned int m_chunksFinished;
-
+
/**
* @brief the chunkExecutionStates holds per chunk the execution state. this state can be
* - COM_ES_NOT_SCHEDULED: not scheduled
@@ -155,7 +155,7 @@ private:
* - COM_ES_EXECUTED: executed
*/
ChunkExecutionState *m_chunkExecutionStates;
-
+
/**
* @brief indicator when this ExecutionGroup has valid Operations in its vector for Execution
* @note When building the ExecutionGroup Operations are added via recursion. First a WriteBufferOperations is added, then the
@@ -184,7 +184,7 @@ private:
* @param operation the operation to be added
*/
bool canContainOperation(NodeOperation *operation);
-
+
/**
* @brief calculate the actual chunk size of this execution group.
* @note A chunk size is an unsigned int that is both the height and width of a chunk.
@@ -192,21 +192,21 @@ private:
* @note by the calling method.
*/
unsigned int determineChunkSize();
-
-
+
+
/**
* @brief Determine the rect (minx, maxx, miny, maxy) of a chunk at a position.
* @note Only gives useful results ater the determination of the chunksize
* @see determineChunkSize()
*/
void determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const;
-
+
/**
* @brief determine the number of chunks, based on the chunkSize, width and height.
* @note The result are stored in the fields numberOfChunks, numberOfXChunks, numberOfYChunks
*/
void determineNumberOfChunks();
-
+
/**
* @brief try to schedule a specific chunk.
* @note scheduling succeeds when all input requirements are met and the chunks hasn't been scheduled yet.
@@ -236,7 +236,7 @@ private:
* @param chunknumber
*/
bool scheduleChunk(unsigned int chunkNumber);
-
+
/**
* @brief determine the area of interest of a certain input area
* @note This method only evaluates a single ReadBufferOperation
@@ -250,7 +250,7 @@ private:
public:
// constructors
ExecutionGroup();
-
+
// methods
/**
* @brief add an operation to this ExecutionGroup
@@ -261,7 +261,7 @@ public:
* @return True if the operation was successfully added
*/
bool addOperation(NodeOperation *operation);
-
+
/**
* @brief is this ExecutionGroup an output ExecutionGroup
* @note An OutputExecution group are groups containing a
@@ -281,47 +281,47 @@ public:
* @param resolution
*/
void determineResolution(unsigned int resolution[2]);
-
+
/**
* @brief set the resolution of this executiongroup
* @param resolution
*/
void setResolution(unsigned int resolution[2]) { this->m_width = resolution[0]; this->m_height = resolution[1]; }
-
+
/**
* @brief get the width of this execution group
*/
unsigned int getWidth() const { return m_width; }
-
+
/**
* @brief get the height of this execution group
*/
unsigned int getHeight() const { return m_height; }
-
+
/**
* @brief does this ExecutionGroup contains a complex NodeOperation
*/
bool isComplex() const { return m_complex; }
-
-
+
+
/**
* @brief get the output operation of this ExecutionGroup
* @return NodeOperation *output operation
*/
NodeOperation *getOutputOperation() const;
-
+
/**
* @brief compose multiple chunks into a single chunk
* @return Memorybuffer *consolidated chunk
*/
MemoryBuffer *constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *output);
-
+
/**
* @brief initExecution is called just before the execution of the whole graph will be done.
* @note The implementation will calculate the chunkSize of this execution group.
*/
void initExecution();
-
+
/**
* @brief get all inputbuffers needed to calculate an chunk
* @note all inputbuffers must be executed
@@ -352,14 +352,14 @@ public:
* @param memorybuffers
*/
void finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers);
-
+
/**
* @brief deinitExecution is called just after execution the whole graph.
* @note It will release all needed resources
*/
void deinitExecution();
-
-
+
+
/**
* @brief schedule an ExecutionGroup
* @note this method will return when all chunks have been calculated, or the execution has breaked (by user)
@@ -375,7 +375,7 @@ public:
* @param system
*/
void execute(ExecutionSystem *system);
-
+
/**
* @brief this method determines the MemoryProxy's where this execution group depends on.
* @note After this method determineDependingAreaOfInterest can be called to determine
@@ -383,7 +383,7 @@ public:
* @param memoryProxies result
*/
void determineDependingMemoryProxies(vector<MemoryProxy *> *memoryProxies);
-
+
/**
* @brief Determine the rect (minx, maxx, miny, maxy) of a chunk.
* @note Only gives useful results ater the determination of the chunksize
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 8e8539e3016..07f7979629c 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -132,7 +132,7 @@ void ExecutionSystem::execute()
editingtree->stats_draw(editingtree->sdh, IFACE_("Compositing | Initializing execution"));
DebugInfo::execute_started(this);
-
+
unsigned int order = 0;
for (vector<NodeOperation *>::iterator iter = this->m_operations.begin(); iter != this->m_operations.end(); ++iter) {
NodeOperation *operation = *iter;
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h
index 2c67a5f7b7f..acde4a9b772 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.h
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.h
@@ -114,7 +114,7 @@ class ExecutionSystem {
public:
typedef std::vector<NodeOperation*> Operations;
typedef std::vector<ExecutionGroup*> Groups;
-
+
private:
/**
* @brief the context used during execution
@@ -136,7 +136,7 @@ private: //methods
* find all execution group with output nodes
*/
void findOutputExecutionGroup(vector<ExecutionGroup *> *result, CompositorPriority priority) const;
-
+
/**
* find all execution group with output nodes
*/
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h
index 27baca0ab6f..be948b3e99b 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.h
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.h
@@ -64,29 +64,29 @@ private:
* @brief proxy of the memory (same for all chunks in the same buffer)
*/
MemoryProxy *m_memoryProxy;
-
+
/**
* @brief the type of buffer COM_DT_VALUE, COM_DT_VECTOR, COM_DT_COLOR
*/
DataType m_datatype;
-
-
+
+
/**
* @brief region of this buffer inside relative to the MemoryProxy
*/
rcti m_rect;
-
+
/**
* brief refers to the chunknumber within the executiongroup where related to the MemoryProxy
* @see memoryProxy
*/
unsigned int m_chunkNumber;
-
+
/**
* @brief state of the buffer
*/
MemoryBufferState m_state;
-
+
/**
* @brief the actual float buffer/data
*/
@@ -106,7 +106,7 @@ public:
* @brief construct new MemoryBuffer for a chunk
*/
MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect);
-
+
/**
* @brief construct new temporarily MemoryBuffer for an area
*/
@@ -121,7 +121,7 @@ public:
* @brief destructor
*/
~MemoryBuffer();
-
+
/**
* @brief read the ChunkNumber of this MemoryBuffer
*/
@@ -134,7 +134,7 @@ public:
* @note buffer should already be available in memory
*/
float *getBuffer() { return this->m_buffer; }
-
+
/**
* @brief after execution the state will be set to available by calling this method
*/
@@ -142,14 +142,14 @@ public:
{
this->m_state = COM_MB_AVAILABLE;
}
-
+
inline void wrap_pixel(int &x, int &y, MemoryBufferExtend extend_x, MemoryBufferExtend extend_y)
{
int w = this->m_width;
int h = this->m_height;
x = x - m_rect.xmin;
y = y - m_rect.ymin;
-
+
switch (extend_x) {
case COM_MB_CLIP:
break;
@@ -161,7 +161,7 @@ public:
x = (x >= 0.0f ? (x % w) : (x % w) + w);
break;
}
-
+
switch (extend_y) {
case COM_MB_CLIP:
break;
@@ -174,7 +174,7 @@ public:
break;
}
}
-
+
inline void wrap_pixel(float &x, float &y, MemoryBufferExtend extend_x, MemoryBufferExtend extend_y)
{
float w = (float)this->m_width;
@@ -249,7 +249,7 @@ public:
float *buffer = &this->m_buffer[offset];
memcpy(result, buffer, sizeof(float) * this->m_num_channels);
}
-
+
void writePixel(int x, int y, const float color[4]);
void addPixel(int x, int y, const float color[4]);
inline void readBilinear(float *result, float x, float y,
@@ -271,12 +271,12 @@ public:
}
void readEWA(float *result, const float uv[2], const float derivatives[2][2]);
-
+
/**
* @brief is this MemoryBuffer a temporarily buffer (based on an area, not on a chunk)
*/
inline const bool isTemporarily() const { return this->m_state == COM_MB_TEMPORARILY; }
-
+
/**
* @brief add the content from otherBuffer to this MemoryBuffer
* @param otherBuffer source buffer
@@ -285,29 +285,29 @@ public:
* uninitialized values in areas where the buffers don't overlap.
*/
void copyContentFrom(MemoryBuffer *otherBuffer);
-
+
/**
* @brief get the rect of this MemoryBuffer
*/
rcti *getRect() { return &this->m_rect; }
-
+
/**
* @brief get the width of this MemoryBuffer
*/
int getWidth() const;
-
+
/**
* @brief get the height of this MemoryBuffer
*/
int getHeight() const;
-
+
/**
* @brief clear the buffer. Make all pixels black transparent.
*/
void clear();
-
+
MemoryBuffer *duplicate();
-
+
float getMaximumValue();
float getMaximumValue(rcti *rect);
private:
diff --git a/source/blender/compositor/intern/COM_MemoryProxy.h b/source/blender/compositor/intern/COM_MemoryProxy.h
index 755d513c72f..b732db37db2 100644
--- a/source/blender/compositor/intern/COM_MemoryProxy.h
+++ b/source/blender/compositor/intern/COM_MemoryProxy.h
@@ -42,17 +42,17 @@ private:
* @brief reference to the ouput operation of the executiongroup
*/
WriteBufferOperation *m_writeBufferOperation;
-
+
/**
* @brief reference to the executor. the Execution group that can fill a chunk
*/
ExecutionGroup *m_executor;
-
+
/**
* @brief datatype of this MemoryProxy
*/
/* DataType m_datatype; */ /* UNUSED */
-
+
/**
* @brief channel information of this buffer
*/
@@ -70,7 +70,7 @@ private:
public:
MemoryProxy(DataType type);
-
+
/**
* @brief set the ExecutionGroup that can be scheduled to calculate a certain chunk.
* @param group the ExecutionGroup to set
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp
index a374403fef7..67b64baa26e 100644
--- a/source/blender/compositor/intern/COM_Node.cpp
+++ b/source/blender/compositor/intern/COM_Node.cpp
@@ -54,7 +54,7 @@ Node::Node(bNode *editorNode, bool create_sockets) :
DataType dt = COM_DT_VALUE;
if (input->type == SOCK_RGBA) dt = COM_DT_COLOR;
if (input->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
-
+
this->addInputSocket(dt, input);
input = input->next;
}
@@ -63,7 +63,7 @@ Node::Node(bNode *editorNode, bool create_sockets) :
DataType dt = COM_DT_VALUE;
if (output->type == SOCK_RGBA) dt = COM_DT_COLOR;
if (output->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
-
+
this->addOutputSocket(dt, output);
output = output->next;
}
@@ -96,7 +96,7 @@ void Node::addInputSocket(DataType datatype, bNodeSocket *bSocket)
void Node::addOutputSocket(DataType datatype)
{
this->addOutputSocket(datatype, NULL);
-
+
}
void Node::addOutputSocket(DataType datatype, bNodeSocket *bSocket)
{
diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h
index 1c28292fb2e..1b78e7fec6d 100644
--- a/source/blender/compositor/intern/COM_Node.h
+++ b/source/blender/compositor/intern/COM_Node.h
@@ -45,13 +45,13 @@ class Node {
public:
typedef std::vector<NodeInput *> Inputs;
typedef std::vector<NodeOutput *> Outputs;
-
+
private:
/**
* @brief stores the reference to the SDNA bNode struct
*/
bNodeTree *m_editorNodeTree;
-
+
/**
* @brief stores the reference to the SDNA bNode struct
*/
@@ -82,7 +82,7 @@ protected:
* @brief get access to the vector of input sockets
*/
const Inputs &getInputSockets() const { return this->m_inputsockets; }
-
+
/**
* @brief get access to the vector of input sockets
*/
@@ -101,14 +101,14 @@ public:
* @brief get the reference to the SDNA bNodeTree struct
*/
bNodeTree *getbNodeTree() const {return m_editorNodeTree;}
-
+
/**
* @brief set the reference to the bNode
* @note used in Node instances to receive the storage/settings and complex node for highlight during execution
* @param bNode
*/
void setbNode(bNode *node) {this->m_editorNode = node;}
-
+
/**
* @brief set the reference to the bNodeTree
* @param bNodeTree
@@ -131,35 +131,35 @@ public:
* the index of the needed outputsocket
*/
NodeOutput *getOutputSocket(const unsigned int index) const;
-
+
/**
* get the reference to the first outputsocket
* @param index
* the index of the needed outputsocket
*/
inline NodeOutput *getOutputSocket() const { return getOutputSocket(0); }
-
+
/**
* get the reference to a certain inputsocket
* @param index
* the index of the needed inputsocket
*/
NodeInput *getInputSocket(const unsigned int index) const;
-
+
/** Check if this is an input node
* An input node is a node that only has output sockets and no input sockets
*/
bool isInputNode() const { return m_inputsockets.empty(); }
-
+
/**
* @brief Is this node in the active group (the group that is being edited)
* @param isInActiveGroup
*/
void setIsInActiveGroup(bool value) { this->m_inActiveGroup = value; }
-
+
/**
* @brief Is this node part of the active group
- * the active group is the group that is currently being edited. When no group is edited,
+ * the active group is the group that is currently being edited. When no group is edited,
* the active group will be the main tree (all nodes that are not part of a group will be active)
* @return bool [false:true]
*/
@@ -174,7 +174,7 @@ public:
* @param context reference to the CompositorContext
*/
virtual void convertToOperations(NodeConverter &converter, const CompositorContext &context) const = 0;
-
+
/**
* Create dummy warning operation, use when we can't get the source data.
*/
@@ -185,10 +185,10 @@ public:
* into valid outputs, without this the compositor system gets confused and crashes, see [#32490]
*/
void convertToOperations_invalid(NodeConverter *compiler) const;
-
+
void setInstanceKey(bNodeInstanceKey instance_key) { m_instanceKey = instance_key; }
bNodeInstanceKey getInstanceKey() const { return m_instanceKey; }
-
+
protected:
/**
* @brief add an NodeInput to the collection of inputsockets
@@ -197,7 +197,7 @@ protected:
*/
void addInputSocket(DataType datatype);
void addInputSocket(DataType datatype, bNodeSocket *socket);
-
+
/**
* @brief add an NodeOutput to the collection of outputsockets
* @note may only be called in an constructor
@@ -205,7 +205,7 @@ protected:
*/
void addOutputSocket(DataType datatype);
void addOutputSocket(DataType datatype, bNodeSocket *socket);
-
+
bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex);
bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex);
};
@@ -219,26 +219,26 @@ class NodeInput {
private:
Node *m_node;
bNodeSocket *m_editorSocket;
-
+
DataType m_datatype;
-
+
/**
* @brief link connected to this NodeInput.
* An input socket can only have a single link
*/
NodeOutput *m_link;
-
+
public:
NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype);
-
+
Node *getNode() const { return this->m_node; }
DataType getDataType() const { return m_datatype; }
bNodeSocket *getbNodeSocket() const { return this->m_editorSocket; }
-
+
void setLink(NodeOutput *link);
bool isLinked() const { return m_link; }
NodeOutput *getLink() { return m_link; }
-
+
float getEditorValueFloat();
void getEditorValueColor(float *value);
void getEditorValueVector(float *value);
@@ -253,16 +253,16 @@ class NodeOutput {
private:
Node *m_node;
bNodeSocket *m_editorSocket;
-
+
DataType m_datatype;
-
+
public:
NodeOutput(Node *node, bNodeSocket *b_socket, DataType datatype);
-
+
Node *getNode() const { return this->m_node; }
DataType getDataType() const { return m_datatype; }
bNodeSocket *getbNodeSocket() const { return this->m_editorSocket; }
-
+
float getEditorValueFloat();
void getEditorValueColor(float *value);
void getEditorValueVector(float *value);
diff --git a/source/blender/compositor/intern/COM_NodeConverter.cpp b/source/blender/compositor/intern/COM_NodeConverter.cpp
index df8a7e6353c..1b62466f81f 100644
--- a/source/blender/compositor/intern/COM_NodeConverter.cpp
+++ b/source/blender/compositor/intern/COM_NodeConverter.cpp
@@ -73,13 +73,13 @@ NodeOperation *NodeConverter::setInvalidOutput(NodeOutput *output)
{
/* this is a really bad situation - bring on the pink! - so artists know this is bad */
const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
-
+
SetColorOperation *operation = new SetColorOperation();
operation->setChannels(warning_color);
-
+
m_builder->addOperation(operation);
m_builder->mapOutputSocket(output, operation->getOutputSocket());
-
+
return operation;
}
@@ -87,9 +87,9 @@ NodeOperationOutput *NodeConverter::addInputProxy(NodeInput *input, bool use_con
{
SocketProxyOperation *proxy = new SocketProxyOperation(input->getDataType(), use_conversion);
m_builder->addOperation(proxy);
-
+
m_builder->mapInputSocket(input, proxy->getInputSocket(0));
-
+
return proxy->getOutputSocket();
}
@@ -97,9 +97,9 @@ NodeOperationInput *NodeConverter::addOutputProxy(NodeOutput *output, bool use_c
{
SocketProxyOperation *proxy = new SocketProxyOperation(output->getDataType(), use_conversion);
m_builder->addOperation(proxy);
-
+
m_builder->mapOutputSocket(output, proxy->getOutputSocket());
-
+
return proxy->getInputSocket(0);
}
@@ -107,7 +107,7 @@ void NodeConverter::addInputValue(NodeOperationInput *input, float value)
{
SetValueOperation *operation = new SetValueOperation();
operation->setValue(value);
-
+
m_builder->addOperation(operation);
m_builder->addLink(operation->getOutputSocket(), input);
}
@@ -116,7 +116,7 @@ void NodeConverter::addInputColor(NodeOperationInput *input, const float value[4
{
SetColorOperation *operation = new SetColorOperation();
operation->setChannels(value);
-
+
m_builder->addOperation(operation);
m_builder->addLink(operation->getOutputSocket(), input);
}
@@ -125,7 +125,7 @@ void NodeConverter::addInputVector(NodeOperationInput *input, const float value[
{
SetVectorOperation *operation = new SetVectorOperation();
operation->setVector(value);
-
+
m_builder->addOperation(operation);
m_builder->addLink(operation->getOutputSocket(), input);
}
@@ -134,7 +134,7 @@ void NodeConverter::addOutputValue(NodeOutput *output, float value)
{
SetValueOperation *operation = new SetValueOperation();
operation->setValue(value);
-
+
m_builder->addOperation(operation);
m_builder->mapOutputSocket(output, operation->getOutputSocket());
}
@@ -143,7 +143,7 @@ void NodeConverter::addOutputColor(NodeOutput *output, const float value[4])
{
SetColorOperation *operation = new SetColorOperation();
operation->setChannels(value);
-
+
m_builder->addOperation(operation);
m_builder->mapOutputSocket(output, operation->getOutputSocket());
}
@@ -152,7 +152,7 @@ void NodeConverter::addOutputVector(NodeOutput *output, const float value[3])
{
SetVectorOperation *operation = new SetVectorOperation();
operation->setVector(value);
-
+
m_builder->addOperation(operation);
m_builder->mapOutputSocket(output, operation->getOutputSocket());
}
diff --git a/source/blender/compositor/intern/COM_NodeConverter.h b/source/blender/compositor/intern/COM_NodeConverter.h
index fb7529ae2a7..825c26bb7af 100644
--- a/source/blender/compositor/intern/COM_NodeConverter.h
+++ b/source/blender/compositor/intern/COM_NodeConverter.h
@@ -44,28 +44,28 @@ class ViewerOperation;
class NodeConverter {
public:
NodeConverter(NodeOperationBuilder *builder);
-
+
/** Insert a new operation into the operations graph.
* The operation must be created by the node.
*/
void addOperation(NodeOperation *operation);
-
+
/** Map input socket of the node to an operation socket.
* Links between nodes will then generate equivalent links between
* the mapped operation sockets.
- *
+ *
* \note A \a Node input can be mapped to multiple \a NodeOperation inputs.
*/
void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket);
/** Map output socket of the node to an operation socket.
* Links between nodes will then generate equivalent links between
* the mapped operation sockets.
- *
+ *
* \note A \a Node output can only be mapped to one \a NodeOperation output.
* Any existing operation output mapping will be replaced.
*/
void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket);
-
+
/** Create a proxy operation for a node input.
* This operation will be removed later and replaced
* by direct links between the connected operations.
@@ -76,39 +76,39 @@ public:
* by direct links between the connected operations.
*/
NodeOperationInput *addOutputProxy(NodeOutput *output, bool use_conversion);
-
+
/** Define a constant input value. */
void addInputValue(NodeOperationInput *input, float value);
/** Define a constant input color. */
void addInputColor(NodeOperationInput *input, const float value[4]);
/** Define a constant input vector. */
void addInputVector(NodeOperationInput *input, const float value[3]);
-
+
/** Define a constant output value. */
void addOutputValue(NodeOutput *output, float value);
/** Define a constant output color. */
void addOutputColor(NodeOutput *output, const float value[4]);
/** Define a constant output vector. */
void addOutputVector(NodeOutput *output, const float value[3]);
-
+
/** Add an explicit link between two operations. */
void addLink(NodeOperationOutput *from, NodeOperationInput *to);
-
+
/** Add a preview operation for a operation output. */
void addPreview(NodeOperationOutput *output);
/** Add a preview operation for a node input. */
void addNodeInputPreview(NodeInput *input);
-
+
/** When a node has no valid data
* @note missing image / group pointer, or missing renderlayer from EXR
*/
NodeOperation *setInvalidOutput(NodeOutput *output);
-
+
/** Define a viewer operation as the active output, if possible */
void registerViewer(ViewerOperation *viewer);
/** The currently active viewer output operation */
ViewerOperation *active_viewer() const;
-
+
private:
/** The internal builder for storing the results of the graph construction. */
NodeOperationBuilder *m_builder;
diff --git a/source/blender/compositor/intern/COM_NodeGraph.cpp b/source/blender/compositor/intern/COM_NodeGraph.cpp
index 5196108818b..d78450074ed 100644
--- a/source/blender/compositor/intern/COM_NodeGraph.cpp
+++ b/source/blender/compositor/intern/COM_NodeGraph.cpp
@@ -82,16 +82,16 @@ void NodeGraph::add_node(Node *node, bNodeTree *b_ntree, bNodeInstanceKey key, b
node->setbNodeTree(b_ntree);
node->setInstanceKey(key);
node->setIsInActiveGroup(is_active_group);
-
+
m_nodes.push_back(node);
-
+
DebugInfo::node_added(node);
}
void NodeGraph::add_link(NodeOutput *fromSocket, NodeInput *toSocket)
{
m_links.push_back(Link(fromSocket, toSocket));
-
+
/* register with the input */
toSocket->setLink(fromSocket);
}
@@ -99,10 +99,10 @@ void NodeGraph::add_link(NodeOutput *fromSocket, NodeInput *toSocket)
void NodeGraph::add_bNodeTree(const CompositorContext &context, int nodes_start, bNodeTree *tree, bNodeInstanceKey parent_key)
{
const bNodeTree *basetree = context.getbNodeTree();
-
+
/* update viewers in the active edittree as well the base tree (for backdrop) */
bool is_active_group = (parent_key.value == basetree->active_viewer_key.value);
-
+
/* add all nodes of the tree to the node list */
for (bNode *node = (bNode *)tree->nodes.first; node; node = node->next) {
bNodeInstanceKey key = BKE_node_instance_key(parent_key, tree, node);
@@ -123,13 +123,13 @@ void NodeGraph::add_bNode(const CompositorContext &context, bNodeTree *b_ntree,
add_proxies_mute(b_ntree, b_node, key, is_active_group);
return;
}
-
+
/* replace slow nodes with proxies for fast execution */
if (context.isFastCalculation() && !Converter::is_fast_node(b_node)) {
add_proxies_skip(b_ntree, b_node, key, is_active_group);
return;
}
-
+
/* special node types */
if (b_node->type == NODE_GROUP) {
add_proxies_group(context, b_node, key);
@@ -181,15 +181,15 @@ void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink
return;
if ((b_nodelink->fromsock->flag & SOCK_UNAVAIL) || (b_nodelink->tosock->flag & SOCK_UNAVAIL))
return;
-
+
/* Note: a DNA input socket can have multiple NodeInput in the compositor tree! (proxies)
* The output then gets linked to each one of them.
*/
-
+
NodeOutput *output = find_output(node_range, b_nodelink->fromsock);
if (!output)
return;
-
+
NodeInputs inputs = find_inputs(node_range, b_nodelink->tosock);
for (NodeInputs::const_iterator it = inputs.begin(); it != inputs.end(); ++it) {
NodeInput *input = *it;
@@ -213,13 +213,13 @@ void NodeGraph::add_proxies_skip(bNodeTree *b_ntree, bNode *b_node, bNodeInstanc
{
for (bNodeSocket *output = (bNodeSocket *)b_node->outputs.first; output; output = output->next) {
bNodeSocket *input;
-
+
/* look for first input with matching datatype for each output */
for (input = (bNodeSocket *)b_node->inputs.first; input; input = input->next) {
if (input->type == output->type)
break;
}
-
+
if (input) {
SocketProxyNode *proxy = new SocketProxyNode(b_node, input, output, true);
add_node(proxy, b_ntree, key, is_active_group);
@@ -231,11 +231,11 @@ void NodeGraph::add_proxies_group_inputs(bNode *b_node, bNode *b_node_io)
{
bNodeTree *b_group_tree = (bNodeTree *)b_node->id;
BLI_assert(b_group_tree); /* should have been checked in advance */
-
+
/* not important for proxies */
bNodeInstanceKey key = NODE_INSTANCE_KEY_BASE;
bool is_active_group = false;
-
+
for (bNodeSocket *b_sock_io = (bNodeSocket *)b_node_io->outputs.first; b_sock_io; b_sock_io = b_sock_io->next) {
bNodeSocket *b_sock_group = find_b_node_input(b_node, b_sock_io->identifier);
if (b_sock_group) {
@@ -249,11 +249,11 @@ void NodeGraph::add_proxies_group_outputs(bNode *b_node, bNode *b_node_io, bool
{
bNodeTree *b_group_tree = (bNodeTree *)b_node->id;
BLI_assert(b_group_tree); /* should have been checked in advance */
-
+
/* not important for proxies */
bNodeInstanceKey key = NODE_INSTANCE_KEY_BASE;
bool is_active_group = false;
-
+
for (bNodeSocket *b_sock_io = (bNodeSocket *)b_node_io->inputs.first; b_sock_io; b_sock_io = b_sock_io->next) {
bNodeSocket *b_sock_group = find_b_node_output(b_node, b_sock_io->identifier);
if (b_sock_group) {
@@ -286,11 +286,11 @@ void NodeGraph::add_proxies_group(const CompositorContext &context, bNode *b_nod
for (bNode *b_node_io = (bNode *)b_group_tree->nodes.first; b_node_io; b_node_io = b_node_io->next) {
if (b_node_io->type == NODE_GROUP_INPUT)
add_proxies_group_inputs(b_node, b_node_io);
-
+
if (b_node_io->type == NODE_GROUP_OUTPUT && (b_node_io->flag & NODE_DO_OUTPUT))
add_proxies_group_outputs(b_node, b_node_io, context.isGroupnodeBufferEnabled());
}
-
+
add_bNodeTree(context, nodes_start, b_group_tree, key);
}
diff --git a/source/blender/compositor/intern/COM_NodeGraph.h b/source/blender/compositor/intern/COM_NodeGraph.h
index fe8740fee97..7c6322d2a42 100644
--- a/source/blender/compositor/intern/COM_NodeGraph.h
+++ b/source/blender/compositor/intern/COM_NodeGraph.h
@@ -48,66 +48,66 @@ public:
private:
NodeOutput *m_from;
NodeInput *m_to;
-
+
public:
Link(NodeOutput *from, NodeInput *to) :
m_from(from),
m_to(to)
{}
-
+
NodeOutput *getFromSocket() const { return m_from; }
NodeInput *getToSocket() const { return m_to; }
};
-
+
typedef std::vector<Node *> Nodes;
typedef Nodes::iterator NodeIterator;
typedef std::vector<Link> Links;
-
+
private:
Nodes m_nodes;
Links m_links;
-
+
public:
NodeGraph();
~NodeGraph();
-
+
const Nodes &nodes() const { return m_nodes; }
const Links &links() const { return m_links; }
-
+
void from_bNodeTree(const CompositorContext &context, bNodeTree *tree);
-
+
protected:
typedef std::pair<NodeIterator, NodeIterator> NodeRange;
typedef std::vector<NodeInput *> NodeInputs;
-
+
static bNodeSocket *find_b_node_input(bNode *b_node, const char *identifier);
static bNodeSocket *find_b_node_output(bNode *b_node, const char *identifier);
-
+
void add_node(Node *node, bNodeTree *b_ntree, bNodeInstanceKey key, bool is_active_group);
void add_link(NodeOutput *fromSocket, NodeInput *toSocket);
-
+
void add_bNodeTree(const CompositorContext &context, int nodes_start, bNodeTree *tree, bNodeInstanceKey parent_key);
-
+
void add_bNode(const CompositorContext &context, bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group);
-
+
NodeInputs find_inputs(const NodeRange &node_range, bNodeSocket *b_socket);
NodeOutput *find_output(const NodeRange &node_range, bNodeSocket *b_socket);
void add_bNodeLink(const NodeRange &node_range, bNodeLink *bNodeLink);
-
+
/* **** Special proxy node type conversions **** */
/* These nodes are not represented in the node graph themselves,
* but converted into a number of proxy links
*/
-
+
void add_proxies_mute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group);
void add_proxies_skip(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group);
-
+
void add_proxies_group_inputs(bNode *b_node, bNode *b_node_io);
void add_proxies_group_outputs(bNode *b_node, bNode *b_node_io, bool use_buffer);
void add_proxies_group(const CompositorContext &context, bNode *b_node, bNodeInstanceKey key);
void add_proxies_reroute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group);
-
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeGraph")
#endif
diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp
index 496a27b379c..1063386aa58 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.cpp
+++ b/source/blender/compositor/intern/COM_NodeOperation.cpp
@@ -83,7 +83,7 @@ void NodeOperation::determineResolution(unsigned int resolution[2], unsigned int
{
unsigned int temp[2];
unsigned int temp2[2];
-
+
for (unsigned int index = 0; index < m_inputs.size(); index++) {
NodeOperationInput *input = m_inputs[index];
if (input->isConnected()) {
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index 1f3c72a820e..5ee3cc22b53 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -81,11 +81,11 @@ class NodeOperation : public SocketReader {
public:
typedef std::vector<NodeOperationInput*> Inputs;
typedef std::vector<NodeOperationOutput*> Outputs;
-
+
private:
Inputs m_inputs;
Outputs m_outputs;
-
+
/**
* @brief the index of the input socket that will be used to determine the resolution
*/
@@ -115,7 +115,7 @@ private:
* @see NodeOperation.getMutex retrieve a pointer to this mutex.
*/
ThreadMutex m_mutex;
-
+
/**
* @brief reference to the editing bNodeTree, used for break and update callback
*/
@@ -125,21 +125,21 @@ private:
* @brief set to truth when resolution for this operation is set
*/
bool m_isResolutionSet;
-
+
public:
virtual ~NodeOperation();
-
+
unsigned int getNumberOfInputSockets() const { return m_inputs.size(); }
unsigned int getNumberOfOutputSockets() const { return m_outputs.size(); }
NodeOperationOutput *getOutputSocket(unsigned int index) const;
NodeOperationOutput *getOutputSocket() const { return getOutputSocket(0); }
NodeOperationInput *getInputSocket(unsigned int index) const;
-
+
/** Check if this is an input operation
* An input operation is an operation that only has output sockets and no input sockets
*/
bool isInputOperation() const { return m_inputs.empty(); }
-
+
/**
* @brief determine the resolution of this node
* @note this method will not set the resolution, this is the responsibility of the caller
@@ -167,7 +167,7 @@ public:
void setbNodeTree(const bNodeTree *tree) { this->m_btree = tree; }
virtual void initExecution();
-
+
/**
* @brief when a chunk is executed by a CPUDevice, this method is called
* @ingroup execution
@@ -231,7 +231,7 @@ public:
this->m_isResolutionSet = true;
}
}
-
+
void getConnectedInputSockets(Inputs *sockets);
@@ -288,14 +288,14 @@ public:
* @see ExecutionGroup.addOperation
*/
bool isOpenCL() const { return this->m_openCL; }
-
+
virtual bool isViewerOperation() const { return false; }
virtual bool isPreviewOperation() const { return false; }
virtual bool isFileOutputOperation() const { return false; }
virtual bool isProxyOperation() const { return false; }
-
+
virtual bool useDatatypeConversion() const { return true; }
-
+
inline bool isBreaked() const {
return this->m_btree->test_break(this->m_btree->tbh);
}
@@ -319,7 +319,7 @@ protected:
void initMutex();
void lockMutex();
void unlockMutex();
-
+
/**
* @brief set whether this operation is complex
*
@@ -345,35 +345,35 @@ protected:
class NodeOperationInput {
private:
NodeOperation *m_operation;
-
+
/** Datatype of this socket. Is used for automatically data transformation.
* @section data-conversion
*/
DataType m_datatype;
-
+
/** Resize mode of this socket */
InputResizeMode m_resizeMode;
-
+
/** Connected output */
NodeOperationOutput *m_link;
-
+
public:
NodeOperationInput(NodeOperation *op, DataType datatype, InputResizeMode resizeMode = COM_SC_CENTER);
-
+
NodeOperation &getOperation() const { return *m_operation; }
DataType getDataType() const { return m_datatype; }
-
+
void setLink(NodeOperationOutput *link) { m_link = link; }
NodeOperationOutput *getLink() const { return m_link; }
bool isConnected() const { return m_link; }
-
+
void setResizeMode(InputResizeMode resizeMode) { this->m_resizeMode = resizeMode; }
InputResizeMode getResizeMode() const { return this->m_resizeMode; }
-
+
SocketReader *getReader();
-
+
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
-
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation")
#endif
@@ -383,18 +383,18 @@ public:
class NodeOperationOutput {
private:
NodeOperation *m_operation;
-
+
/** Datatype of this socket. Is used for automatically data transformation.
* @section data-conversion
*/
DataType m_datatype;
-
+
public:
NodeOperationOutput(NodeOperation *op, DataType datatype);
-
+
NodeOperation &getOperation() const { return *m_operation; }
DataType getDataType() const { return m_datatype; }
-
+
/**
* @brief determine the resolution of this data going through this socket
* @param resolution the result of this operation
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
index fc1584e3dbb..f282037823a 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
@@ -58,18 +58,18 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
{
/* interface handle for nodes */
NodeConverter converter(this);
-
+
for (int index = 0; index < m_graph.nodes().size(); index++) {
Node *node = (Node *)m_graph.nodes()[index];
-
+
m_current_node = node;
-
+
DebugInfo::node_to_operations(node);
node->convertToOperations(converter, *m_context);
}
-
+
m_current_node = NULL;
-
+
/* The input map constructed by nodes maps operation inputs to node inputs.
* Inverting yields a map of node inputs to all connected operation inputs,
* so multiple operations can use the same node input.
@@ -77,12 +77,12 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
OpInputInverseMap inverse_input_map;
for (InputSocketMap::const_iterator it = m_input_map.begin(); it != m_input_map.end(); ++it)
inverse_input_map[it->second].push_back(it->first);
-
+
for (NodeGraph::Links::const_iterator it = m_graph.links().begin(); it != m_graph.links().end(); ++it) {
const NodeGraph::Link &link = *it;
NodeOutput *from = link.getFromSocket();
NodeInput *to = link.getToSocket();
-
+
NodeOperationOutput *op_from = find_operation_output(m_output_map, from);
const OpInputs &op_to_list = find_operation_inputs(inverse_input_map, to);
if (!op_from || op_to_list.empty()) {
@@ -94,36 +94,36 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
*/
continue;
}
-
+
for (OpInputs::const_iterator it = op_to_list.begin(); it != op_to_list.end(); ++it) {
NodeOperationInput *op_to = *it;
addLink(op_from, op_to);
}
}
-
+
add_operation_input_constants();
-
+
resolve_proxies();
-
+
add_datatype_conversions();
-
+
determineResolutions();
-
+
/* surround complex ops with read/write buffer */
add_complex_operation_buffers();
-
+
/* links not available from here on */
/* XXX make m_links a local variable to avoid confusion! */
m_links.clear();
-
+
prune_operations();
-
+
/* ensure topological (link-based) order of nodes */
/*sort_operations();*/ /* not needed yet */
-
+
/* create execution groups */
group_operations();
-
+
/* transfer resulting operations to the system */
system->set_operations(m_operations, m_groups);
}
@@ -137,7 +137,7 @@ void NodeOperationBuilder::mapInputSocket(NodeInput *node_socket, NodeOperationI
{
BLI_assert(m_current_node);
BLI_assert(node_socket->getNode() == m_current_node);
-
+
/* note: this maps operation sockets to node sockets.
* for resolving links the map will be inverted first in convertToOperations,
* to get a list of links for each node input socket.
@@ -149,7 +149,7 @@ void NodeOperationBuilder::mapOutputSocket(NodeOutput *node_socket, NodeOperatio
{
BLI_assert(m_current_node);
BLI_assert(node_socket->getNode() == m_current_node);
-
+
m_output_map[node_socket] = operation_socket;
}
@@ -157,9 +157,9 @@ void NodeOperationBuilder::addLink(NodeOperationOutput *from, NodeOperationInput
{
if (to->isConnected())
return;
-
+
m_links.push_back(Link(from, to));
-
+
/* register with the input */
to->setLink(from);
}
@@ -171,7 +171,7 @@ void NodeOperationBuilder::removeInputLink(NodeOperationInput *to)
if (link.to() == to) {
/* unregister with the input */
to->setLink(NULL);
-
+
m_links.erase(it);
return;
}
@@ -200,7 +200,7 @@ NodeOperationOutput *NodeOperationBuilder::find_operation_output(const OutputSoc
PreviewOperation *NodeOperationBuilder::make_preview_operation() const
{
BLI_assert(m_current_node);
-
+
if (!(m_current_node->getbNode()->flag & NODE_PREVIEW))
return NULL;
/* previews only in the active group */
@@ -209,7 +209,7 @@ PreviewOperation *NodeOperationBuilder::make_preview_operation() const
/* do not calculate previews of hidden nodes */
if (m_current_node->getbNode()->flag & NODE_HIDDEN)
return NULL;
-
+
bNodeInstanceHash *previews = m_context->getPreviewHash();
if (previews) {
PreviewOperation *operation = new PreviewOperation(m_context->getViewSettings(), m_context->getDisplaySettings());
@@ -217,7 +217,7 @@ PreviewOperation *NodeOperationBuilder::make_preview_operation() const
operation->verifyPreview(previews, m_current_node->getInstanceKey());
return operation;
}
-
+
return NULL;
}
@@ -226,7 +226,7 @@ void NodeOperationBuilder::addPreview(NodeOperationOutput *output)
PreviewOperation *operation = make_preview_operation();
if (operation) {
addOperation(operation);
-
+
addLink(output, operation->getInputSocket(0));
}
}
@@ -236,7 +236,7 @@ void NodeOperationBuilder::addNodeInputPreview(NodeInput *input)
PreviewOperation *operation = make_preview_operation();
if (operation) {
addOperation(operation);
-
+
mapInputSocket(input, operation->getInputSocket(0));
}
}
@@ -247,7 +247,7 @@ void NodeOperationBuilder::registerViewer(ViewerOperation *viewer)
if (m_current_node->isInActiveGroup()) {
/* deactivate previous viewer */
m_active_viewer->setActive(false);
-
+
m_active_viewer = viewer;
viewer->setActive(true);
}
@@ -269,13 +269,13 @@ void NodeOperationBuilder::add_datatype_conversions()
Links convert_links;
for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) {
const Link &link = *it;
-
+
/* proxy operations can skip data type conversion */
NodeOperation *from_op = &link.from()->getOperation();
NodeOperation *to_op = &link.to()->getOperation();
if (!(from_op->useDatatypeConversion() || to_op->useDatatypeConversion()))
continue;
-
+
if (link.from()->getDataType() != link.to()->getDataType())
convert_links.push_back(link);
}
@@ -284,7 +284,7 @@ void NodeOperationBuilder::add_datatype_conversions()
NodeOperation *converter = Converter::convertDataType(link.from(), link.to());
if (converter) {
addOperation(converter);
-
+
removeInputLink(link.to());
addLink(link.from(), converter->getInputSocket(0));
addLink(converter->getOutputSocket(0), link.to());
@@ -322,7 +322,7 @@ void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input, N
value = node_input->getEditorValueFloat();
else
value = 0.0f;
-
+
SetValueOperation *op = new SetValueOperation();
op->setValue(value);
addOperation(op);
@@ -335,7 +335,7 @@ void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input, N
node_input->getEditorValueColor(value);
else
zero_v4(value);
-
+
SetColorOperation *op = new SetColorOperation();
op->setChannels(value);
addOperation(op);
@@ -348,7 +348,7 @@ void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input, N
node_input->getEditorValueVector(value);
else
zero_v3(value);
-
+
SetVectorOperation *op = new SetVectorOperation();
op->setVector(value);
addOperation(op);
@@ -370,17 +370,17 @@ void NodeOperationBuilder::resolve_proxies()
proxy_links.push_back(link);
}
}
-
+
for (Links::const_iterator it = proxy_links.begin(); it != proxy_links.end(); ++it) {
const Link &link = *it;
-
+
NodeOperationInput *to = link.to();
NodeOperationOutput *from = link.from();
do {
/* walk upstream bypassing the proxy operation */
from = from->getOperation().getInputSocket(0)->getLink();
} while (from && from->getOperation().isProxyOperation());
-
+
removeInputLink(to);
/* we may not have a final proxy input link,
* in that case it just gets dropped
@@ -395,7 +395,7 @@ void NodeOperationBuilder::determineResolutions()
/* determine all resolutions of the operations (Width/Height) */
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
NodeOperation *op = *it;
-
+
if (op->isOutputOperation(m_context->isRendering()) && !op->isPreviewOperation()) {
unsigned int resolution[2] = {0, 0};
unsigned int preferredResolution[2] = {0, 0};
@@ -403,10 +403,10 @@ void NodeOperationBuilder::determineResolutions()
op->setResolution(resolution);
}
}
-
+
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
NodeOperation *op = *it;
-
+
if (op->isOutputOperation(m_context->isRendering()) && op->isPreviewOperation()) {
unsigned int resolution[2] = {0, 0};
unsigned int preferredResolution[2] = {0, 0};
@@ -414,13 +414,13 @@ void NodeOperationBuilder::determineResolutions()
op->setResolution(resolution);
}
}
-
+
/* add convert resolution operations when needed */
{
Links convert_links;
for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) {
const Link &link = *it;
-
+
if (link.to()->getResizeMode() != COM_SC_NO_RESIZE) {
NodeOperation &from_op = link.from()->getOperation();
NodeOperation &to_op = link.to()->getOperation();
@@ -464,35 +464,35 @@ void NodeOperationBuilder::add_input_buffers(NodeOperation * /*operation*/,
{
if (!input->isConnected())
return;
-
+
NodeOperationOutput *output = input->getLink();
if (output->getOperation().isReadBufferOperation()) {
/* input is already buffered, no need to add another */
return;
}
-
+
/* this link will be replaced below */
removeInputLink(input);
-
+
/* check of other end already has write operation, otherwise add a new one */
WriteBufferOperation *writeoperation = find_attached_write_buffer_operation(output);
if (!writeoperation) {
writeoperation = new WriteBufferOperation(output->getDataType());
writeoperation->setbNodeTree(m_context->getbNodeTree());
addOperation(writeoperation);
-
+
addLink(output, writeoperation->getInputSocket(0));
-
+
writeoperation->readResolutionFromInputSocket();
}
-
+
/* add readbuffer op for the input */
ReadBufferOperation *readoperation = new ReadBufferOperation(output->getDataType());
readoperation->setMemoryProxy(writeoperation->getMemoryProxy());
this->addOperation(readoperation);
-
+
addLink(readoperation->getOutputSocket(), input);
-
+
readoperation->readResolutionFromWriteBuffer();
}
@@ -502,11 +502,11 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, NodeOper
OpInputs targets = cache_output_links(output);
if (targets.empty())
return;
-
+
WriteBufferOperation *writeOperation = NULL;
for (OpInputs::const_iterator it = targets.begin(); it != targets.end(); ++it) {
NodeOperationInput *target = *it;
-
+
/* try to find existing write buffer operation */
if (target->getOperation().isWriteBufferOperation()) {
BLI_assert(writeOperation == NULL); /* there should only be one write op connected */
@@ -517,30 +517,30 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, NodeOper
removeInputLink(target);
}
}
-
+
/* if no write buffer operation exists yet, create a new one */
if (!writeOperation) {
writeOperation = new WriteBufferOperation(operation->getOutputSocket()->getDataType());
writeOperation->setbNodeTree(m_context->getbNodeTree());
addOperation(writeOperation);
-
+
addLink(output, writeOperation->getInputSocket(0));
}
-
+
writeOperation->readResolutionFromInputSocket();
-
+
/* add readbuffer op for every former connected input */
for (OpInputs::const_iterator it = targets.begin(); it != targets.end(); ++it) {
NodeOperationInput *target = *it;
if (&target->getOperation() == writeOperation)
continue; /* skip existing write op links */
-
+
ReadBufferOperation *readoperation = new ReadBufferOperation(operation->getOutputSocket()->getDataType());
readoperation->setMemoryProxy(writeOperation->getMemoryProxy());
addOperation(readoperation);
-
+
addLink(readoperation->getOutputSocket(), target);
-
+
readoperation->readResolutionFromWriteBuffer();
}
}
@@ -554,15 +554,15 @@ void NodeOperationBuilder::add_complex_operation_buffers()
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it)
if ((*it)->isComplex())
complex_ops.push_back(*it);
-
+
for (Operations::const_iterator it = complex_ops.begin(); it != complex_ops.end(); ++it) {
NodeOperation *op = *it;
-
+
DebugInfo::operation_read_write_buffer(op);
-
+
for (int index = 0; index < op->getNumberOfInputSockets(); index++)
add_input_buffers(op, op->getInputSocket(index));
-
+
for (int index = 0; index < op->getNumberOfOutputSockets(); index++)
add_output_buffers(op, op->getOutputSocket(index));
}
@@ -575,13 +575,13 @@ static void find_reachable_operations_recursive(Tags &reachable, NodeOperation *
if (reachable.find(op) != reachable.end())
return;
reachable.insert(op);
-
+
for (int i = 0; i < op->getNumberOfInputSockets(); ++i) {
NodeOperationInput *input = op->getInputSocket(i);
if (input->isConnected())
find_reachable_operations_recursive(reachable, &input->getLink()->getOperation());
}
-
+
/* associated write-buffer operations are executed as well */
if (op->isReadBufferOperation()) {
ReadBufferOperation *read_op = (ReadBufferOperation *)op;
@@ -595,17 +595,17 @@ void NodeOperationBuilder::prune_operations()
Tags reachable;
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
NodeOperation *op = *it;
-
+
/* output operations are primary executed operations */
if (op->isOutputOperation(m_context->isRendering()))
find_reachable_operations_recursive(reachable, op);
}
-
+
/* delete unreachable operations */
Operations reachable_ops;
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
NodeOperation *op = *it;
-
+
if (reachable.find(op) != reachable.end())
reachable_ops.push_back(op);
else
@@ -621,13 +621,13 @@ static void sort_operations_recursive(NodeOperationBuilder::Operations &sorted,
if (visited.find(op) != visited.end())
return;
visited.insert(op);
-
+
for (int i = 0; i < op->getNumberOfInputSockets(); ++i) {
NodeOperationInput *input = op->getInputSocket(i);
if (input->isConnected())
sort_operations_recursive(sorted, visited, &input->getLink()->getOperation());
}
-
+
sorted.push_back(op);
}
@@ -636,10 +636,10 @@ void NodeOperationBuilder::sort_operations()
Operations sorted;
sorted.reserve(m_operations.size());
Tags visited;
-
+
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it)
sort_operations_recursive(sorted, visited, *it);
-
+
m_operations = sorted;
}
@@ -648,10 +648,10 @@ static void add_group_operations_recursive(Tags &visited, NodeOperation *op, Exe
if (visited.find(op) != visited.end())
return;
visited.insert(op);
-
+
if (!group->addOperation(op))
return;
-
+
/* add all eligible input ops to the group */
for (int i = 0; i < op->getNumberOfInputSockets(); ++i) {
NodeOperationInput *input = op->getInputSocket(i);
@@ -664,10 +664,10 @@ ExecutionGroup *NodeOperationBuilder::make_group(NodeOperation *op)
{
ExecutionGroup *group = new ExecutionGroup();
m_groups.push_back(group);
-
+
Tags visited;
add_group_operations_recursive(visited, op, group);
-
+
return group;
}
@@ -675,17 +675,17 @@ void NodeOperationBuilder::group_operations()
{
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
NodeOperation *op = *it;
-
+
if (op->isOutputOperation(m_context->isRendering())) {
ExecutionGroup *group = make_group(op);
group->setOutputExecutionGroup(true);
}
-
+
/* add new groups for associated memory proxies where needed */
if (op->isReadBufferOperation()) {
ReadBufferOperation *read_op = (ReadBufferOperation *)op;
MemoryProxy *memproxy = read_op->getMemoryProxy();
-
+
if (memproxy->getExecutor() == NULL) {
ExecutionGroup *group = make_group(memproxy->getWriteBufferOperation());
memproxy->setExecutor(group);
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.h b/source/blender/compositor/intern/COM_NodeOperationBuilder.h
index 2bb5b94c57f..0eafd27b46a 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.h
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.h
@@ -52,48 +52,48 @@ public:
private:
NodeOperationOutput *m_from;
NodeOperationInput *m_to;
-
+
public:
Link(NodeOperationOutput *from, NodeOperationInput *to) :
m_from(from),
m_to(to)
{}
-
+
NodeOperationOutput *from() const { return m_from; }
NodeOperationInput *to() const { return m_to; }
};
-
+
typedef std::vector<NodeOperation *> Operations;
typedef std::vector<Link> Links;
typedef std::vector<ExecutionGroup *> Groups;
-
+
typedef std::map<NodeOperationInput *, NodeInput *> InputSocketMap;
typedef std::map<NodeOutput *, NodeOperationOutput *> OutputSocketMap;
-
+
typedef std::vector<NodeOperationInput *> OpInputs;
typedef std::map<NodeInput *, OpInputs> OpInputInverseMap;
-
+
private:
const CompositorContext *m_context;
NodeGraph m_graph;
-
+
Operations m_operations;
Links m_links;
Groups m_groups;
-
+
/** Maps operation inputs to node inputs */
InputSocketMap m_input_map;
/** Maps node outputs to operation outputs */
OutputSocketMap m_output_map;
-
+
Node *m_current_node;
-
+
/** Operation that will be writing to the viewer image
* Only one operation can occupy this place at a time,
* to avoid race conditions
*/
ViewerOperation *m_active_viewer;
-
+
public:
NodeOperationBuilder(const CompositorContext *context, bNodeTree *b_nodetree);
~NodeOperationBuilder();
@@ -103,43 +103,43 @@ public:
void convertToOperations(ExecutionSystem *system);
void addOperation(NodeOperation *operation);
-
+
/** Map input socket of the current node to an operation socket */
void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket);
/** Map output socket of the current node to an operation socket */
void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket);
-
+
void addLink(NodeOperationOutput *from, NodeOperationInput *to);
void removeInputLink(NodeOperationInput *to);
-
+
/** Add a preview operation for a operation output */
void addPreview(NodeOperationOutput *output);
/** Add a preview operation for a node input */
void addNodeInputPreview(NodeInput *input);
-
+
/** Define a viewer operation as the active output, if possible */
void registerViewer(ViewerOperation *viewer);
/** The currently active viewer output operation */
ViewerOperation *active_viewer() const { return m_active_viewer; }
-
+
protected:
static NodeInput *find_node_input(const InputSocketMap &map, NodeOperationInput *op_input);
static const OpInputs &find_operation_inputs(const OpInputInverseMap &map, NodeInput *node_input);
static NodeOperationOutput *find_operation_output(const OutputSocketMap &map, NodeOutput *node_output);
-
+
/** Add datatype conversion where needed */
void add_datatype_conversions();
-
+
/** Construct a constant value operation for every unconnected input */
void add_operation_input_constants();
void add_input_constant_value(NodeOperationInput *input, NodeInput *node_input);
-
+
/** Replace proxy operations with direct links */
void resolve_proxies();
-
+
/** Calculate resolution for each operation */
void determineResolutions();
-
+
/** Helper function to store connected inputs for replacement */
OpInputs cache_output_links(NodeOperationOutput *output) const;
/** Find a connected write buffer operation to an OpOutput */
@@ -148,17 +148,17 @@ protected:
void add_complex_operation_buffers();
void add_input_buffers(NodeOperation *operation, NodeOperationInput *input);
void add_output_buffers(NodeOperation *operation, NodeOperationOutput *output);
-
+
/** Remove unreachable operations */
void prune_operations();
-
+
/** Sort operations by link dependencies */
void sort_operations();
-
+
/** Create execution groups */
void group_operations();
ExecutionGroup *make_group(NodeOperation *op);
-
+
private:
PreviewOperation *make_preview_operation() const;
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
index 54044f747fb..881c7b8f49a 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
@@ -74,7 +74,7 @@ void OpenCLDevice::execute(WorkPackage *work)
chunkNumber, inputBuffers, outputBuffer);
delete outputBuffer;
-
+
executionGroup->finalizeChunkExecution(chunkNumber, inputBuffers);
}
cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex,
@@ -106,7 +106,7 @@ cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
ReadBufferOperation *reader)
{
cl_int error;
-
+
MemoryBuffer *result = reader->getInputMemoryBuffer(inputMemoryBuffers);
const cl_image_format *imageFormat = determineImageFormat(result);
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h
index 78d3c66cb5c..fa358f65ddf 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.h
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.h
@@ -42,17 +42,17 @@ private:
* @brief opencl context
*/
cl_context m_context;
-
+
/**
* @brief opencl device
*/
cl_device_id m_device;
-
+
/**
* @brief opencl program
*/
cl_program m_program;
-
+
/**
* @brief opencl command queue
*/
@@ -72,8 +72,8 @@ public:
* @param vendorID
*/
OpenCLDevice(cl_context context, cl_device_id device, cl_program program, cl_int vendorId);
-
-
+
+
/**
* @brief initialize the device
* During initialization the OpenCL cl_command_queue is created
@@ -81,13 +81,13 @@ public:
* @see queue
*/
bool initialize();
-
+
/**
* @brief deinitialize the device
* During deintiialization the command queue is cleared
*/
void deinitialize();
-
+
/**
* @brief execute a WorkPackage
* @param work the WorkPackage to execute
diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp
index 27d4d0951e8..9ab67a40055 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp
+++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp
@@ -49,7 +49,7 @@ void SingleThreadedOperation::deinitExecution()
void *SingleThreadedOperation::initializeTileData(rcti *rect)
{
if (this->m_cachedInstance) return this->m_cachedInstance;
-
+
lockMutex();
if (this->m_cachedInstance == NULL) {
//
diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.h b/source/blender/compositor/intern/COM_SingleThreadedOperation.h
index 82d0b04e064..e0dc06ef733 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedOperation.h
+++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.h
@@ -27,7 +27,7 @@
class SingleThreadedOperation : public NodeOperation {
private:
MemoryBuffer *m_cachedInstance;
-
+
protected:
inline bool isCached() {
return this->m_cachedInstance != NULL;
@@ -35,17 +35,17 @@ protected:
public:
SingleThreadedOperation();
-
+
/**
* the inner loop of this program
*/
void executePixel(float output[4], int x, int y, void *data);
-
+
/**
* Initialize the execution
*/
void initExecution();
-
+
/**
* Deinitialize the execution
*/
@@ -54,7 +54,7 @@ public:
void *initializeTileData(rcti *rect);
virtual MemoryBuffer *createMemoryBuffer(rcti *rect) = 0;
-
+
int isSingleThreaded() { return true; }
};
#endif
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index ce45b9fdbe9..4136983e13c 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -85,7 +85,7 @@ void *WorkScheduler::thread_execute_cpu(void *data)
device->execute(work);
delete work;
}
-
+
return NULL;
}
@@ -93,12 +93,12 @@ void *WorkScheduler::thread_execute_gpu(void *data)
{
Device *device = (Device *)data;
WorkPackage *work;
-
+
while ((work = (WorkPackage *)BLI_thread_queue_pop(g_gpuqueue))) {
device->execute(work);
delete work;
}
-
+
return NULL;
}
#endif
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.h b/source/blender/compositor/intern/COM_WorkScheduler.h
index 7f07978a9c7..14b02e70913 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.h
+++ b/source/blender/compositor/intern/COM_WorkScheduler.h
@@ -53,7 +53,7 @@ class WorkScheduler {
* inside this loop new work is queried and being executed
*/
static void *thread_execute_gpu(void *data);
-#endif
+#endif
public:
/**
* @brief schedule a chunk of a group to be calculated.
diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp
index 467286084f9..4599832b433 100644
--- a/source/blender/compositor/intern/COM_compositor.cpp
+++ b/source/blender/compositor/intern/COM_compositor.cpp
@@ -94,7 +94,7 @@ void COM_execute(RenderData *rd, Scene *scene, bNodeTree *editingtree, int rende
ExecutionSystem *system = new ExecutionSystem(rd, scene, editingtree, rendering, twopass, viewSettings, displaySettings, viewName);
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.