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-30 09:23:09 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-30 17:03:43 +0300
commit3ead9b2b3605580554cc330d2d2525f405e9c779 (patch)
tree634650b941210833444cf0947eb4682c513e5d70 /source/blender/compositor
parent5a6d5d20de2cfa43d14d67970b2f2eb24048b230 (diff)
Cleanup: Replace virtual methods with bitflags.
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cc4
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.h41
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.cc13
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedOperation.cc1
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.cc1
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_SocketProxyOperation.cc3
-rw-r--r--source/blender/compositor/operations/COM_SocketProxyOperation.h19
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cc1
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.h4
11 files changed, 32 insertions, 64 deletions
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc
index f44f6e952fb..87c9e6e8a69 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cc
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc
@@ -106,7 +106,7 @@ bool ExecutionGroup::addOperation(NodeOperation *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_flags.single_threaded = operation->get_flags().single_threaded;
m_flags.initialized = true;
}
@@ -191,7 +191,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c
float centerY = 0.5f;
ChunkOrdering order_type = ChunkOrdering::Default;
- if (operation->isViewerOperation()) {
+ if (operation->get_flags().is_viewer_operation) {
ViewerOperation *viewer = (ViewerOperation *)operation;
centerX = viewer->getCenterX();
centerY = viewer->getCenterY();
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index 6ad97e5eba6..1a299160cee 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -182,6 +182,8 @@ struct NodeOperationFlags {
*/
bool open_cl : 1;
+ bool single_threaded : 1;
+
/**
* Does the operation needs a viewer border.
* Basically, setting border need to happen for only operations
@@ -210,10 +212,22 @@ struct NodeOperationFlags {
bool is_set_operation : 1;
bool is_write_buffer_operation : 1;
bool is_read_buffer_operation : 1;
+ bool is_proxy_operation : 1;
+ bool is_viewer_operation : 1;
+ bool is_preview_operation : 1;
+
+ /**
+ * When set additional data conversion operations are added to
+ * convert the data. SocketProxyOperation don't always need to do data conversions.
+ *
+ * By default data conversions are enabled.
+ */
+ bool use_datatype_conversion : 1;
NodeOperationFlags()
{
complex = false;
+ single_threaded = false;
open_cl = false;
use_render_border = false;
use_viewer_border = false;
@@ -221,6 +235,10 @@ struct NodeOperationFlags {
is_set_operation = false;
is_read_buffer_operation = false;
is_write_buffer_operation = false;
+ is_proxy_operation = false;
+ is_viewer_operation = false;
+ is_preview_operation = false;
+ use_datatype_conversion = true;
}
};
@@ -330,11 +348,6 @@ class NodeOperation {
return false;
}
- virtual int isSingleThreaded()
- {
- return false;
- }
-
void setbNodeTree(const bNodeTree *tree)
{
this->m_btree = tree;
@@ -442,24 +455,6 @@ class NodeOperation {
return CompositorPriority::Low;
}
- virtual bool isViewerOperation() const
- {
- return false;
- }
- virtual bool isPreviewOperation() const
- {
- return false;
- }
- virtual bool isProxyOperation() const
- {
- return false;
- }
-
- virtual bool useDatatypeConversion() const
- {
- return true;
- }
-
inline bool isBraked() const
{
return this->m_btree->test_break(this->m_btree->tbh);
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
index 24b72fa737a..fdd48da3fb4 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
@@ -256,7 +256,8 @@ void NodeOperationBuilder::add_datatype_conversions()
/* 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())) {
+ if (!(from_op->get_flags().use_datatype_conversion ||
+ to_op->get_flags().use_datatype_conversion)) {
continue;
}
@@ -352,8 +353,8 @@ void NodeOperationBuilder::resolve_proxies()
blender::Vector<Link> proxy_links;
for (const Link &link : m_links) {
/* don't replace links from proxy to proxy, since we may need them for replacing others! */
- if (link.from()->getOperation().isProxyOperation() &&
- !link.to()->getOperation().isProxyOperation()) {
+ if (link.from()->getOperation().get_flags().is_proxy_operation &&
+ !link.to()->getOperation().get_flags().is_proxy_operation) {
proxy_links.append(link);
}
}
@@ -364,7 +365,7 @@ void NodeOperationBuilder::resolve_proxies()
do {
/* walk upstream bypassing the proxy operation */
from = from->getOperation().getInputSocket(0)->getLink();
- } while (from && from->getOperation().isProxyOperation());
+ } while (from && from->getOperation().get_flags().is_proxy_operation);
removeInputLink(to);
/* we may not have a final proxy input link,
@@ -380,7 +381,7 @@ void NodeOperationBuilder::determineResolutions()
{
/* determine all resolutions of the operations (Width/Height) */
for (NodeOperation *op : m_operations) {
- if (op->isOutputOperation(m_context->isRendering()) && !op->isPreviewOperation()) {
+ if (op->isOutputOperation(m_context->isRendering()) && !op->get_flags().is_preview_operation) {
unsigned int resolution[2] = {0, 0};
unsigned int preferredResolution[2] = {0, 0};
op->determineResolution(resolution, preferredResolution);
@@ -389,7 +390,7 @@ void NodeOperationBuilder::determineResolutions()
}
for (NodeOperation *op : m_operations) {
- if (op->isOutputOperation(m_context->isRendering()) && op->isPreviewOperation()) {
+ if (op->isOutputOperation(m_context->isRendering()) && op->get_flags().is_preview_operation) {
unsigned int resolution[2] = {0, 0};
unsigned int preferredResolution[2] = {0, 0};
op->determineResolution(resolution, preferredResolution);
diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc
index c5e4c7ee9fd..01be6e1afed 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc
+++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc
@@ -24,6 +24,7 @@ SingleThreadedOperation::SingleThreadedOperation()
{
this->m_cachedInstance = nullptr;
flags.complex = true;
+ flags.single_threaded = true;
}
void SingleThreadedOperation::initExecution()
diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.h b/source/blender/compositor/intern/COM_SingleThreadedOperation.h
index 1f741578a95..9945f938ff9 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedOperation.h
+++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.h
@@ -53,11 +53,6 @@ class SingleThreadedOperation : public NodeOperation {
void *initializeTileData(rcti *rect) override;
virtual MemoryBuffer *createMemoryBuffer(rcti *rect) = 0;
-
- int isSingleThreaded() override
- {
- return true;
- }
};
} // namespace blender::compositor
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cc b/source/blender/compositor/operations/COM_PreviewOperation.cc
index fd30f2fc610..9a1990740f4 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.cc
+++ b/source/blender/compositor/operations/COM_PreviewOperation.cc
@@ -51,6 +51,7 @@ PreviewOperation::PreviewOperation(const ColorManagedViewSettings *viewSettings,
this->m_defaultWidth = defaultWidth;
this->m_defaultHeight = defaultHeight;
flags.use_viewer_border = true;
+ flags.is_preview_operation = true;
}
void PreviewOperation::verifyPreview(bNodeInstanceHash *previews, bNodeInstanceKey key)
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h
index d310bf9b01a..5e2b27475a1 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.h
+++ b/source/blender/compositor/operations/COM_PreviewOperation.h
@@ -63,10 +63,6 @@ class PreviewOperation : public NodeOperation {
bool determineDependingAreaOfInterest(rcti *input,
ReadBufferOperation *readOperation,
rcti *output) override;
- bool isPreviewOperation() const override
- {
- return true;
- }
};
} // namespace blender::compositor
diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.cc b/source/blender/compositor/operations/COM_SocketProxyOperation.cc
index 5b5be17bf95..39876439b7b 100644
--- a/source/blender/compositor/operations/COM_SocketProxyOperation.cc
+++ b/source/blender/compositor/operations/COM_SocketProxyOperation.cc
@@ -21,10 +21,11 @@
namespace blender::compositor {
SocketProxyOperation::SocketProxyOperation(DataType type, bool use_conversion)
- : m_use_conversion(use_conversion)
{
this->addInputSocket(type);
this->addOutputSocket(type);
+ flags.is_proxy_operation = true;
+ flags.use_datatype_conversion = use_conversion;
}
std::unique_ptr<MetaData> SocketProxyOperation::getMetaData()
diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.h b/source/blender/compositor/operations/COM_SocketProxyOperation.h
index db621d29cac..27fb6e0f204 100644
--- a/source/blender/compositor/operations/COM_SocketProxyOperation.h
+++ b/source/blender/compositor/operations/COM_SocketProxyOperation.h
@@ -26,27 +26,8 @@ class SocketProxyOperation : public NodeOperation {
public:
SocketProxyOperation(DataType type, bool use_conversion);
- bool isProxyOperation() const override
- {
- return true;
- }
- bool useDatatypeConversion() const override
- {
- return m_use_conversion;
- }
-
- bool getUseConversion() const
- {
- return m_use_conversion;
- }
- void setUseConversion(bool use_conversion)
- {
- m_use_conversion = use_conversion;
- }
std::unique_ptr<MetaData> getMetaData() override;
- private:
- bool m_use_conversion;
};
} // namespace blender::compositor
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc
index dc52a91ef87..1ae0fe6101f 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cc
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cc
@@ -56,6 +56,7 @@ ViewerOperation::ViewerOperation()
this->m_rd = nullptr;
this->m_viewName = nullptr;
flags.use_viewer_border = true;
+ flags.is_viewer_operation = true;
}
void ViewerOperation::initExecution()
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h
index 2d3795da035..8406ea41f20 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerOperation.h
@@ -103,10 +103,6 @@ class ViewerOperation : public NodeOperation {
return this->m_chunkOrder;
}
CompositorPriority getRenderPriority() const override;
- bool isViewerOperation() const override
- {
- return true;
- }
void setUseAlphaInput(bool value)
{
this->m_useAlphaInput = value;