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:
authorJeroen Bakker <jeroen@blender.org>2021-03-29 17:54:02 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-29 18:10:01 +0300
commit2db2b7de55836725266e67a7f2f342b032c4fa3a (patch)
tree99ee5083363a7885d7416a255a03859c66e684a6 /source/blender/compositor
parentfe60062a9910161d411da6e14690755d814c4cb1 (diff)
Cleanup: Replace `is...Operation()` methods with a flag.
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/intern/COM_Debug.cc8
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cc18
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.h14
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cc8
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.h47
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.cc10
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.cc1
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_SetColorOperation.cc1
-rw-r--r--source/blender/compositor/operations/COM_SetColorOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_SetValueOperation.cc1
-rw-r--r--source/blender/compositor/operations/COM_SetValueOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_SetVectorOperation.cc1
-rw-r--r--source/blender/compositor/operations/COM_SetVectorOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_TrackPositionOperation.cc1
-rw-r--r--source/blender/compositor/operations/COM_TrackPositionOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_WriteBufferOperation.cc1
-rw-r--r--source/blender/compositor/operations/COM_WriteBufferOperation.h4
18 files changed, 46 insertions, 90 deletions
diff --git a/source/blender/compositor/intern/COM_Debug.cc b/source/blender/compositor/intern/COM_Debug.cc
index ac694768add..1612072a2e8 100644
--- a/source/blender/compositor/intern/COM_Debug.cc
+++ b/source/blender/compositor/intern/COM_Debug.cc
@@ -135,13 +135,13 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system,
else if (operation->isOutputOperation(system->getContext().isRendering())) {
fillcolor = "dodgerblue1";
}
- else if (operation->isSetOperation()) {
+ else if (operation->get_flags().is_set_operation()) {
fillcolor = "khaki1";
}
- else if (operation->isReadBufferOperation()) {
+ else if (operation->get_flags().is_read_buffer_operation) {
fillcolor = "darkolivegreen3";
}
- else if (operation->isWriteBufferOperation()) {
+ else if (operation->get_flags().is_write_buffer_operation) {
fillcolor = "darkorange";
}
@@ -362,7 +362,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
}
for (NodeOperation *operation : system->m_operations) {
- if (operation->isReadBufferOperation()) {
+ if (operation->get_flags().is_read_buffer_operation) {
ReadBufferOperation *read = (ReadBufferOperation *)operation;
WriteBufferOperation *write = read->getMemoryProxy()->getWriteBufferOperation();
std::vector<std::string> &read_groups = op_groups[read];
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc
index 9f9effd430d..f44f6e952fb 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cc
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc
@@ -57,7 +57,6 @@ ExecutionGroup::ExecutionGroup()
this->m_x_chunks_len = 0;
this->m_y_chunks_len = 0;
this->m_chunks_len = 0;
- this->m_initialized = false;
this->m_chunks_finished = 0;
BLI_rcti_init(&this->m_viewerBorder, 0, 0, 0, 0);
this->m_executionStartTime = 0;
@@ -70,17 +69,17 @@ CompositorPriority ExecutionGroup::getRenderPriority()
bool ExecutionGroup::can_contain(NodeOperation &operation)
{
- if (!this->m_initialized) {
+ if (!m_flags.initialized) {
return true;
}
- if (operation.isReadBufferOperation()) {
+ if (operation.get_flags().is_read_buffer_operation) {
return true;
}
- if (operation.isWriteBufferOperation()) {
+ if (operation.get_flags().is_write_buffer_operation) {
return false;
}
- if (operation.isSetOperation()) {
+ if (operation.get_flags().is_set_operation) {
return true;
}
@@ -103,11 +102,12 @@ bool ExecutionGroup::addOperation(NodeOperation *operation)
return false;
}
- if (!operation->isReadBufferOperation() && !operation->isWriteBufferOperation()) {
+ if (!operation->get_flags().is_read_buffer_operation &&
+ !operation->get_flags().is_write_buffer_operation) {
m_flags.complex = operation->get_flags().complex;
m_flags.open_cl = operation->get_flags().open_cl;
m_flags.single_threaded = operation->isSingleThreaded();
- m_initialized = true;
+ m_flags.initialized = true;
}
m_operations.append(operation);
@@ -134,7 +134,7 @@ void ExecutionGroup::initExecution()
unsigned int max_offset = 0;
for (NodeOperation *operation : m_operations) {
- if (operation->isReadBufferOperation()) {
+ if (operation->get_flags().is_read_buffer_operation) {
ReadBufferOperation *readOperation = static_cast<ReadBufferOperation *>(operation);
this->m_read_operations.append(readOperation);
max_offset = MAX2(max_offset, readOperation->getOffset());
@@ -453,7 +453,7 @@ MemoryBuffer *ExecutionGroup::allocateOutputBuffer(rcti &rect)
{
// we assume that this method is only called from complex execution groups.
NodeOperation *operation = this->getOutputOperation();
- if (operation->isWriteBufferOperation()) {
+ if (operation->get_flags().is_write_buffer_operation) {
WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation;
MemoryBuffer *buffer = new MemoryBuffer(
writeOperation->getMemoryProxy(), rect, MemoryBufferState::Temporary);
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h
index f97aa0ff985..a995da38dec 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.h
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.h
@@ -61,6 +61,7 @@ enum class eChunkExecutionState {
};
struct ExecutionGroupFlags {
+ bool initialized : 1;
/**
* Is this ExecutionGroup an output ExecutionGroup
* An OutputExecution group are groups containing a
@@ -82,6 +83,7 @@ struct ExecutionGroupFlags {
ExecutionGroupFlags()
{
+ initialized = false;
is_output = false;
complex = false;
open_cl = false;
@@ -169,18 +171,6 @@ class ExecutionGroup {
blender::Vector<eChunkExecutionState> m_chunk_execution_states;
/**
- * \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.
- * \note Operation containing the settings that is important for the ExecutiongGroup is added,
- * \note When this occurs, these settings are copied over from the node to the ExecutionGroup
- * \note and the Initialized flag is set to true.
- * \see complex
- * \see openCL
- */
- bool m_initialized;
-
- /**
* \brief denotes boundary for border compositing
* \note measured in pixel space
*/
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cc b/source/blender/compositor/intern/COM_ExecutionSystem.cc
index b3adca5ac51..9a3dc6ee56f 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cc
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cc
@@ -130,7 +130,7 @@ static void update_read_buffer_offset(blender::Vector<NodeOperation *> &operatio
{
unsigned int order = 0;
for (NodeOperation *operation : operations) {
- if (operation->isReadBufferOperation()) {
+ if (operation->get_flags().is_read_buffer_operation) {
ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
readOperation->setOffset(order);
order++;
@@ -142,7 +142,7 @@ static void init_write_operations_for_execution(blender::Vector<NodeOperation *>
const bNodeTree *bTree)
{
for (NodeOperation *operation : operations) {
- if (operation->isWriteBufferOperation()) {
+ if (operation->get_flags().is_write_buffer_operation) {
operation->setbNodeTree(bTree);
operation->initExecution();
}
@@ -152,7 +152,7 @@ static void init_write_operations_for_execution(blender::Vector<NodeOperation *>
static void link_write_buffers(blender::Vector<NodeOperation *> &operations)
{
for (NodeOperation *operation : operations) {
- if (operation->isReadBufferOperation()) {
+ if (operation->get_flags().is_read_buffer_operation) {
ReadBufferOperation *readOperation = static_cast<ReadBufferOperation *>(operation);
readOperation->updateMemoryBuffer();
}
@@ -163,7 +163,7 @@ static void init_non_write_operations_for_execution(blender::Vector<NodeOperatio
const bNodeTree *bTree)
{
for (NodeOperation *operation : operations) {
- if (!operation->isWriteBufferOperation()) {
+ if (!operation->get_flags().is_write_buffer_operation) {
operation->setbNodeTree(bTree);
operation->initExecution();
}
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index 88f9c49dbf0..6ad97e5eba6 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -204,6 +204,13 @@ struct NodeOperationFlags {
*/
bool is_resolution_set : 1;
+ /**
+ * Is this a set operation (value, color, vector).
+ */
+ bool is_set_operation : 1;
+ bool is_write_buffer_operation : 1;
+ bool is_read_buffer_operation : 1;
+
NodeOperationFlags()
{
complex = false;
@@ -211,6 +218,9 @@ struct NodeOperationFlags {
use_render_border = false;
use_viewer_border = false;
is_resolution_set = false;
+ is_set_operation = false;
+ is_read_buffer_operation = false;
+ is_write_buffer_operation = false;
}
};
@@ -301,11 +311,11 @@ class NodeOperation {
unsigned int preferredResolution[2]);
/**
- * \brief isOutputOperation determines whether this operation is an output of the ExecutionSystem
- * during rendering or editing.
+ * \brief isOutputOperation determines whether this operation is an output of the
+ * ExecutionSystem during rendering or editing.
*
- * Default behavior if not overridden, this operation will not be evaluated as being an output of
- * the ExecutionSystem.
+ * Default behavior if not overridden, this operation will not be evaluated as being an output
+ * of the ExecutionSystem.
*
* \see ExecutionSystem
* \ingroup check
@@ -400,31 +410,6 @@ class NodeOperation {
}
}
- virtual bool isSetOperation() const
- {
- return false;
- }
-
- /**
- * \brief is this operation of type ReadBufferOperation
- * \return [true:false]
- * \see ReadBufferOperation
- */
- virtual bool isReadBufferOperation() const
- {
- return false;
- }
-
- /**
- * \brief is this operation of type WriteBufferOperation
- * \return [true:false]
- * \see WriteBufferOperation
- */
- virtual bool isWriteBufferOperation() const
- {
- return false;
- }
-
/**
* \brief is this operation the active viewer output
* user can select an ViewerNode to be active
@@ -442,8 +427,8 @@ class NodeOperation {
rcti *output);
/**
- * \brief set the index of the input socket that will determine the resolution of this operation
- * \param index: the index to set
+ * \brief set the index of the input socket that will determine the resolution of this
+ * operation \param index: the index to set
*/
void setResolutionInputSocketIndex(unsigned int index);
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
index 920622651b1..24b72fa737a 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
@@ -433,7 +433,7 @@ WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation
for (const Link &link : m_links) {
if (link.from() == output) {
NodeOperation &op = link.to()->getOperation();
- if (op.isWriteBufferOperation()) {
+ if (op.get_flags().is_write_buffer_operation) {
return (WriteBufferOperation *)(&op);
}
}
@@ -449,7 +449,7 @@ void NodeOperationBuilder::add_input_buffers(NodeOperation * /*operation*/,
}
NodeOperationOutput *output = input->getLink();
- if (output->getOperation().isReadBufferOperation()) {
+ if (output->getOperation().get_flags().is_read_buffer_operation) {
/* input is already buffered, no need to add another */
return;
}
@@ -491,7 +491,7 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation,
WriteBufferOperation *writeOperation = nullptr;
for (NodeOperationInput *target : targets) {
/* try to find existing write buffer operation */
- if (target->getOperation().isWriteBufferOperation()) {
+ if (target->getOperation().get_flags().is_write_buffer_operation) {
BLI_assert(writeOperation == nullptr); /* there should only be one write op connected */
writeOperation = (WriteBufferOperation *)(&target->getOperation());
}
@@ -571,7 +571,7 @@ static void find_reachable_operations_recursive(Tags &reachable, NodeOperation *
}
/* associated write-buffer operations are executed as well */
- if (op->isReadBufferOperation()) {
+ if (op->get_flags().is_read_buffer_operation) {
ReadBufferOperation *read_op = (ReadBufferOperation *)op;
MemoryProxy *memproxy = read_op->getMemoryProxy();
find_reachable_operations_recursive(reachable, memproxy->getWriteBufferOperation());
@@ -675,7 +675,7 @@ void NodeOperationBuilder::group_operations()
}
/* add new groups for associated memory proxies where needed */
- if (op->isReadBufferOperation()) {
+ if (op->get_flags().is_read_buffer_operation) {
ReadBufferOperation *read_op = (ReadBufferOperation *)op;
MemoryProxy *memproxy = read_op->getMemoryProxy();
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cc b/source/blender/compositor/operations/COM_ReadBufferOperation.cc
index 9ed218a0123..cc58f29e8d9 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.cc
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cc
@@ -28,6 +28,7 @@ ReadBufferOperation::ReadBufferOperation(DataType datatype)
this->m_single_value = false;
this->m_offset = 0;
this->m_buffer = nullptr;
+ flags.is_read_buffer_operation = true;
}
void *ReadBufferOperation::initializeTileData(rcti * /*rect*/)
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h
index a14f4e334a9..981c09292af 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.h
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h
@@ -53,10 +53,6 @@ class ReadBufferOperation : public NodeOperation {
MemoryBufferExtend extend_x,
MemoryBufferExtend extend_y);
void executePixelFiltered(float output[4], float x, float y, float dx[2], float dy[2]) override;
- bool isReadBufferOperation() const override
- {
- return true;
- }
void setOffset(unsigned int offset)
{
this->m_offset = offset;
diff --git a/source/blender/compositor/operations/COM_SetColorOperation.cc b/source/blender/compositor/operations/COM_SetColorOperation.cc
index 94e0907309f..dbe45fa60db 100644
--- a/source/blender/compositor/operations/COM_SetColorOperation.cc
+++ b/source/blender/compositor/operations/COM_SetColorOperation.cc
@@ -23,6 +23,7 @@ namespace blender::compositor {
SetColorOperation::SetColorOperation()
{
this->addOutputSocket(DataType::Color);
+ flags.is_set_operation = true;
}
void SetColorOperation::executePixelSampled(float output[4],
diff --git a/source/blender/compositor/operations/COM_SetColorOperation.h b/source/blender/compositor/operations/COM_SetColorOperation.h
index 10244bf7a1a..4b9b80013d4 100644
--- a/source/blender/compositor/operations/COM_SetColorOperation.h
+++ b/source/blender/compositor/operations/COM_SetColorOperation.h
@@ -80,10 +80,6 @@ class SetColorOperation : public NodeOperation {
void determineResolution(unsigned int resolution[2],
unsigned int preferredResolution[2]) override;
- bool isSetOperation() const override
- {
- return true;
- }
};
} // namespace blender::compositor
diff --git a/source/blender/compositor/operations/COM_SetValueOperation.cc b/source/blender/compositor/operations/COM_SetValueOperation.cc
index 6d709aee0c5..ef43cf64653 100644
--- a/source/blender/compositor/operations/COM_SetValueOperation.cc
+++ b/source/blender/compositor/operations/COM_SetValueOperation.cc
@@ -23,6 +23,7 @@ namespace blender::compositor {
SetValueOperation::SetValueOperation()
{
this->addOutputSocket(DataType::Value);
+ flags.is_set_operation = true;
}
void SetValueOperation::executePixelSampled(float output[4],
diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h b/source/blender/compositor/operations/COM_SetValueOperation.h
index c2c34726ad7..c3939ea65ea 100644
--- a/source/blender/compositor/operations/COM_SetValueOperation.h
+++ b/source/blender/compositor/operations/COM_SetValueOperation.h
@@ -52,10 +52,6 @@ class SetValueOperation : public NodeOperation {
void determineResolution(unsigned int resolution[2],
unsigned int preferredResolution[2]) override;
- bool isSetOperation() const override
- {
- return true;
- }
};
} // namespace blender::compositor
diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.cc b/source/blender/compositor/operations/COM_SetVectorOperation.cc
index b6fc766fe02..7152d5e61d4 100644
--- a/source/blender/compositor/operations/COM_SetVectorOperation.cc
+++ b/source/blender/compositor/operations/COM_SetVectorOperation.cc
@@ -24,6 +24,7 @@ namespace blender::compositor {
SetVectorOperation::SetVectorOperation()
{
this->addOutputSocket(DataType::Vector);
+ flags.is_set_operation = true;
}
void SetVectorOperation::executePixelSampled(float output[4],
diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h
index 2a6c4fa51b4..b444339fcb2 100644
--- a/source/blender/compositor/operations/COM_SetVectorOperation.h
+++ b/source/blender/compositor/operations/COM_SetVectorOperation.h
@@ -79,10 +79,6 @@ class SetVectorOperation : public NodeOperation {
void determineResolution(unsigned int resolution[2],
unsigned int preferredResolution[2]) override;
- bool isSetOperation() const override
- {
- return true;
- }
void setVector(const float vector[3])
{
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cc b/source/blender/compositor/operations/COM_TrackPositionOperation.cc
index df865de278b..993410e3e84 100644
--- a/source/blender/compositor/operations/COM_TrackPositionOperation.cc
+++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cc
@@ -41,6 +41,7 @@ TrackPositionOperation::TrackPositionOperation()
this->m_position = CMP_TRACKPOS_ABSOLUTE;
this->m_relativeFrame = 0;
this->m_speed_output = false;
+ flags.is_set_operation = true;
}
void TrackPositionOperation::initExecution()
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.h b/source/blender/compositor/operations/COM_TrackPositionOperation.h
index 81243f644ac..b0b0a123bd6 100644
--- a/source/blender/compositor/operations/COM_TrackPositionOperation.h
+++ b/source/blender/compositor/operations/COM_TrackPositionOperation.h
@@ -93,11 +93,6 @@ class TrackPositionOperation : public NodeOperation {
void initExecution() override;
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
-
- bool isSetOperation() const override
- {
- return true;
- }
};
} // namespace blender::compositor
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cc b/source/blender/compositor/operations/COM_WriteBufferOperation.cc
index 3c0f3b3f3e7..1aa19f26e2b 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.cc
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cc
@@ -29,6 +29,7 @@ WriteBufferOperation::WriteBufferOperation(DataType datatype)
this->m_memoryProxy = new MemoryProxy(datatype);
this->m_memoryProxy->setWriteBufferOperation(this);
this->m_memoryProxy->setExecutor(nullptr);
+ flags.is_write_buffer_operation = true;
}
WriteBufferOperation::~WriteBufferOperation()
{
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h
index 6522899d8cc..2817fbe24b9 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.h
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h
@@ -43,10 +43,6 @@ class WriteBufferOperation : public NodeOperation {
return this->m_memoryProxy;
}
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
- bool isWriteBufferOperation() const override
- {
- return true;
- }
bool isSingleValue() const
{
return m_single_value;