From fe60062a9910161d411da6e14690755d814c4cb1 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Mon, 29 Mar 2021 16:45:49 +0200 Subject: Cleanup: Use Bitflags For Booleans. --- .../compositor/intern/COM_ExecutionGroup.cc | 64 +++-------- .../blender/compositor/intern/COM_ExecutionGroup.h | 83 ++++++-------- .../compositor/intern/COM_ExecutionSystem.cc | 2 +- .../blender/compositor/intern/COM_NodeOperation.cc | 5 +- .../blender/compositor/intern/COM_NodeOperation.h | 126 +++++++++++---------- .../compositor/intern/COM_NodeOperationBuilder.cc | 2 +- .../intern/COM_SingleThreadedOperation.cc | 2 +- .../blender/compositor/intern/COM_WorkScheduler.cc | 2 +- .../blender/compositor/intern/COM_WorkScheduler.h | 2 +- .../operations/COM_AntiAliasOperation.cc | 2 +- .../operations/COM_BilateralBlurOperation.cc | 2 +- .../compositor/operations/COM_BlurBaseOperation.cc | 2 +- .../operations/COM_BokehBlurOperation.cc | 5 +- .../operations/COM_CalculateMeanOperation.cc | 2 +- .../operations/COM_CompositorOperation.cc | 2 + .../operations/COM_ConvolutionFilterOperation.cc | 2 +- .../operations/COM_CryptomatteOperation.cc | 2 +- .../operations/COM_DespeckleOperation.cc | 2 +- .../operations/COM_DilateErodeOperation.cc | 8 +- .../operations/COM_DirectionalBlurOperation.cc | 5 +- .../compositor/operations/COM_DisplaceOperation.cc | 2 +- .../operations/COM_DoubleEdgeMaskOperation.cc | 2 +- .../operations/COM_FastGaussianBlurOperation.cc | 2 +- .../operations/COM_GaussianXBlurOperation.h | 2 +- .../operations/COM_GaussianYBlurOperation.h | 2 +- .../compositor/operations/COM_IDMaskOperation.cc | 2 +- .../compositor/operations/COM_InpaintOperation.cc | 2 +- .../operations/COM_KeyingBlurOperation.cc | 2 +- .../operations/COM_KeyingClipOperation.cc | 2 +- .../operations/COM_KeyingScreenOperation.cc | 2 +- .../compositor/operations/COM_MapUVOperation.cc | 2 +- .../operations/COM_NormalizeOperation.cc | 2 +- .../operations/COM_OutputFileOperation.h | 10 -- .../operations/COM_PlaneCornerPinOperation.cc | 2 +- .../operations/COM_PlaneDistortCommonOperation.cc | 2 +- .../compositor/operations/COM_PreviewOperation.cc | 1 + .../COM_ProjectorLensDistortionOperation.cc | 2 +- .../compositor/operations/COM_SMAAOperation.cc | 6 +- .../COM_ScreenLensDistortionOperation.cc | 2 +- .../compositor/operations/COM_SunBeamsOperation.cc | 2 +- .../compositor/operations/COM_TextureOperation.cc | 2 +- .../compositor/operations/COM_TonemapOperation.cc | 2 +- .../COM_VariableSizeBokehBlurOperation.cc | 6 +- .../operations/COM_VectorBlurOperation.cc | 2 +- .../compositor/operations/COM_ViewerOperation.cc | 1 + .../operations/COM_WriteBufferOperation.cc | 2 +- 46 files changed, 170 insertions(+), 218 deletions(-) diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc index 071b1d41941..9f9effd430d 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cc +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc @@ -50,8 +50,6 @@ namespace blender::compositor { ExecutionGroup::ExecutionGroup() { - this->m_is_output = false; - this->m_complex = false; this->m_bTree = nullptr; this->m_height = 0; this->m_width = 0; @@ -60,8 +58,6 @@ ExecutionGroup::ExecutionGroup() this->m_y_chunks_len = 0; this->m_chunks_len = 0; this->m_initialized = false; - this->m_openCL = false; - this->m_singleThreaded = false; this->m_chunks_finished = 0; BLI_rcti_init(&this->m_viewerBorder, 0, 0, 0, 0); this->m_executionStartTime = 0; @@ -89,12 +85,12 @@ bool ExecutionGroup::can_contain(NodeOperation &operation) } /* complex groups don't allow further ops (except read buffer and values, see above) */ - if (m_complex) { + if (m_flags.complex) { return false; } /* complex ops can't be added to other groups (except their own, which they initialize, see * above) */ - if (operation.isComplex()) { + if (operation.get_flags().complex) { return false; } @@ -108,9 +104,9 @@ bool ExecutionGroup::addOperation(NodeOperation *operation) } if (!operation->isReadBufferOperation() && !operation->isWriteBufferOperation()) { - m_complex = operation->isComplex(); - m_openCL = operation->isOpenCL(); - m_singleThreaded = operation->isSingleThreaded(); + 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; } @@ -168,7 +164,7 @@ void ExecutionGroup::determineResolution(unsigned int resolution[2]) void ExecutionGroup::determineNumberOfChunks() { - if (this->m_singleThreaded) { + if (this->m_flags.single_threaded) { this->m_x_chunks_len = 1; this->m_y_chunks_len = 1; this->m_chunks_len = 1; @@ -429,7 +425,7 @@ inline void ExecutionGroup::determineChunkRect(rcti *rect, const int border_width = BLI_rcti_size_x(&this->m_viewerBorder); const int border_height = BLI_rcti_size_y(&this->m_viewerBorder); - if (this->m_singleThreaded) { + if (this->m_flags.single_threaded) { BLI_rcti_init( rect, this->m_viewerBorder.xmin, border_width, this->m_viewerBorder.ymin, border_height); } @@ -468,7 +464,7 @@ MemoryBuffer *ExecutionGroup::allocateOutputBuffer(rcti &rect) bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area) { - if (this->m_singleThreaded) { + if (this->m_flags.single_threaded) { return scheduleChunkWhenPossible(graph, 0, 0); } // find all chunks inside the rect @@ -560,16 +556,10 @@ void ExecutionGroup::determineDependingAreaOfInterest(rcti *input, this->getOutputOperation()->determineDependingAreaOfInterest(input, readOperation, output); } -bool ExecutionGroup::isOpenCL() -{ - return this->m_openCL; -} - void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float ymax) { - NodeOperation *operation = this->getOutputOperation(); - - if (operation->isViewerOperation() || operation->isPreviewOperation()) { + const NodeOperation &operation = *this->getOutputOperation(); + if (operation.get_flags().use_viewer_border) { BLI_rcti_init(&this->m_viewerBorder, xmin * this->m_width, xmax * this->m_width, @@ -580,33 +570,13 @@ void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float y void ExecutionGroup::setRenderBorder(float xmin, float xmax, float ymin, float ymax) { - NodeOperation *operation = this->getOutputOperation(); - - if (operation->isOutputOperation(true)) { - /* Basically, setting border need to happen for only operations - * which operates in render resolution buffers (like compositor - * output nodes). - * - * In this cases adding border will lead to mapping coordinates - * from output buffer space to input buffer spaces when executing - * operation. - * - * But nodes like viewer and file output just shall display or - * safe the same exact buffer which goes to their input, no need - * in any kind of coordinates mapping. - */ - - bool operationNeedsBorder = !(operation->isViewerOperation() || - operation->isPreviewOperation() || - operation->isFileOutputOperation()); - - if (operationNeedsBorder) { - BLI_rcti_init(&this->m_viewerBorder, - xmin * this->m_width, - xmax * this->m_width, - ymin * this->m_height, - ymax * this->m_height); - } + const NodeOperation &operation = *this->getOutputOperation(); + if (operation.isOutputOperation(true) && operation.get_flags().use_render_border) { + BLI_rcti_init(&this->m_viewerBorder, + xmin * this->m_width, + xmax * this->m_width, + ymin * this->m_height, + ymax * this->m_height); } } diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h index f8bc5f43e31..f97aa0ff985 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.h +++ b/source/blender/compositor/intern/COM_ExecutionGroup.h @@ -60,6 +60,35 @@ enum class eChunkExecutionState { EXECUTED = 2, }; +struct ExecutionGroupFlags { + /** + * Is this ExecutionGroup an output ExecutionGroup + * An OutputExecution group are groups containing a + * ViewerOperation, CompositeOperation, PreviewOperation. + */ + bool is_output : 1; + bool complex : 1; + + /** + * Can this ExecutionGroup be scheduled on an OpenCLDevice. + */ + bool open_cl : 1; + + /** + * Schedule this execution group as a single chunk. This + * chunk will be executed by a single thread. + */ + bool single_threaded : 1; + + ExecutionGroupFlags() + { + is_output = false; + complex = false; + open_cl = false; + single_threaded = false; + } +}; + /** * \brief Class ExecutionGroup is a group of Operations that are executed as one. * This grouping is used to combine Operations that can be executed as one whole when @@ -75,12 +104,7 @@ class ExecutionGroup { */ blender::Vector 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). - */ - bool m_is_output; + ExecutionGroupFlags m_flags; /** * \brief Width of the output @@ -113,21 +137,6 @@ class ExecutionGroup { */ unsigned int m_chunks_len; - /** - * \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. @@ -261,6 +270,11 @@ class ExecutionGroup { // constructors ExecutionGroup(); + const ExecutionGroupFlags get_flags() const + { + return m_flags; + } + // methods /** * \brief add an operation to this ExecutionGroup @@ -272,24 +286,13 @@ class ExecutionGroup { */ bool addOperation(NodeOperation *operation); - /** - * \brief is this ExecutionGroup an output ExecutionGroup - * \note An OutputExecution group are groups containing a - * \note ViewerOperation, CompositeOperation, PreviewOperation. - * \see NodeOperation.isOutputOperation - */ - bool isOutputExecutionGroup() const - { - return this->m_is_output; - } - /** * \brief set whether this ExecutionGroup is an output * \param isOutput: */ void setOutputExecutionGroup(bool is_output) { - this->m_is_output = is_output; + this->m_flags.is_output = is_output; } /** @@ -324,14 +327,6 @@ class ExecutionGroup { 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 @@ -412,12 +407,6 @@ class ExecutionGroup { */ void determineChunkRect(rcti *rect, const unsigned int chunkNumber) const; - /** - * \brief can this ExecutionGroup be scheduled on an OpenCLDevice - * \see WorkScheduler.schedule - */ - bool isOpenCL(); - void setChunksize(int chunksize) { this->m_chunkSize = chunksize; diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cc b/source/blender/compositor/intern/COM_ExecutionSystem.cc index c8e3b11160b..b3adca5ac51 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cc +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cc @@ -215,7 +215,7 @@ void ExecutionSystem::execute() void ExecutionSystem::execute_groups(CompositorPriority priority) { for (ExecutionGroup *execution_group : m_groups) { - if (execution_group->isOutputExecutionGroup() && + if (execution_group->get_flags().is_output && execution_group->getRenderPriority() == priority) { execution_group->execute(this); } diff --git a/source/blender/compositor/intern/COM_NodeOperation.cc b/source/blender/compositor/intern/COM_NodeOperation.cc index a16e2d359f1..cb2134ae5f1 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cc +++ b/source/blender/compositor/intern/COM_NodeOperation.cc @@ -33,11 +33,8 @@ namespace blender::compositor { NodeOperation::NodeOperation() { this->m_resolutionInputSocketIndex = 0; - this->m_complex = false; this->m_width = 0; this->m_height = 0; - this->m_isResolutionSet = false; - this->m_openCL = false; this->m_btree = nullptr; } @@ -202,7 +199,7 @@ void NodeOperationOutput::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) { NodeOperation &operation = getOperation(); - if (operation.isResolutionSet()) { + if (operation.get_flags().is_resolution_set) { resolution[0] = operation.getWidth(); resolution[1] = operation.getHeight(); } diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index 3d334758e7a..88f9c49dbf0 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -165,6 +165,55 @@ class NodeOperationOutput { #endif }; +struct NodeOperationFlags { + /** + * Is this an complex operation. + * + * The input and output buffers of Complex operations are stored in buffers. It allows + * sequential and read/write. + * + * Complex operations are typically doing many reads to calculate the output of a single pixel. + * Mostly Filter types (Blurs, Convolution, Defocus etc) need this to be set to true. + */ + bool complex : 1; + + /** + * Does this operation support OpenCL. + */ + bool open_cl : 1; + + /** + * Does the operation needs a viewer border. + * Basically, setting border need to happen for only operations + * which operates in render resolution buffers (like compositor + * output nodes). + * + * In this cases adding border will lead to mapping coordinates + * from output buffer space to input buffer spaces when executing + * operation. + * + * But nodes like viewer and file output just shall display or + * safe the same exact buffer which goes to their input, no need + * in any kind of coordinates mapping. + */ + bool use_render_border : 1; + bool use_viewer_border : 1; + + /** + * Is the resolution of the operation set. + */ + bool is_resolution_set : 1; + + NodeOperationFlags() + { + complex = false; + open_cl = false; + use_render_border = false; + use_viewer_border = false; + is_resolution_set = false; + } +}; + /** * \brief NodeOperation contains calculation logic * @@ -181,20 +230,6 @@ class NodeOperation { */ unsigned int m_resolutionInputSocketIndex; - /** - * \brief is this operation a complex one. - * - * Complex operations are typically doing many reads to calculate the output of a single pixel. - * Mostly Filter types (Blurs, Convolution, Defocus etc) need this to be set to true. - */ - bool m_complex; - - /** - * \brief can this operation be scheduled on an OpenCL device. - * \note Only applicable if complex is True - */ - bool m_openCL; - /** * \brief mutex reference for very special node initializations * \note only use when you really know what you are doing. @@ -211,11 +246,6 @@ class NodeOperation { */ const bNodeTree *m_btree; - /** - * \brief set to truth when resolution for this operation is set - */ - bool m_isResolutionSet; - protected: /** * Width of the output of this operation. @@ -227,11 +257,21 @@ class NodeOperation { */ unsigned int m_height; + /** + * Flags how to evaluate this operation. + */ + NodeOperationFlags flags; + public: virtual ~NodeOperation() { } + const NodeOperationFlags get_flags() const + { + return flags; + } + unsigned int getNumberOfInputSockets() const { return m_inputs.size(); @@ -347,35 +387,19 @@ class NodeOperation { } virtual void deinitExecution(); - bool isResolutionSet() - { - return this->m_isResolutionSet; - } - /** * \brief set the resolution * \param resolution: the resolution to set */ void setResolution(unsigned int resolution[2]) { - if (!isResolutionSet()) { + if (!this->flags.is_resolution_set) { this->m_width = resolution[0]; this->m_height = resolution[1]; - this->m_isResolutionSet = true; + this->flags.is_resolution_set = true; } } - /** - * \brief is this operation complex - * - * Complex operations are typically doing many reads to calculate the output of a single pixel. - * Mostly Filter types (Blurs, Convolution, Defocus etc) need this to be set to true. - */ - bool isComplex() const - { - return this->m_complex; - } - virtual bool isSetOperation() const { return false; @@ -433,16 +457,6 @@ class NodeOperation { return CompositorPriority::Low; } - /** - * \brief can this NodeOperation be scheduled on an OpenCLDevice - * \see WorkScheduler.schedule - * \see ExecutionGroup.addOperation - */ - bool isOpenCL() const - { - return this->m_openCL; - } - virtual bool isViewerOperation() const { return false; @@ -451,10 +465,6 @@ class NodeOperation { { return false; } - virtual bool isFileOutputOperation() const - { - return false; - } virtual bool isProxyOperation() const { return false; @@ -534,12 +544,12 @@ class NodeOperation { void setWidth(unsigned int width) { this->m_width = width; - this->m_isResolutionSet = true; + this->flags.is_resolution_set = true; } void setHeight(unsigned int height) { this->m_height = height; - this->m_isResolutionSet = true; + this->flags.is_resolution_set = true; } SocketReader *getInputSocketReader(unsigned int inputSocketindex); NodeOperation *getInputOperation(unsigned int inputSocketindex); @@ -557,15 +567,7 @@ class NodeOperation { */ void setComplex(bool complex) { - this->m_complex = complex; - } - - /** - * \brief set if this NodeOperation can be scheduled on a OpenCLDevice - */ - void setOpenCL(bool openCL) - { - this->m_openCL = openCL; + this->flags.complex = complex; } /** diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc index 44adb26a412..920622651b1 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc @@ -536,7 +536,7 @@ void NodeOperationBuilder::add_complex_operation_buffers() */ blender::Vector complex_ops; for (NodeOperation *operation : m_operations) { - if (operation->isComplex()) { + if (operation->get_flags().complex) { complex_ops.append(operation); } } diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc index d7341ff7fdd..c5e4c7ee9fd 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc @@ -23,7 +23,7 @@ namespace blender::compositor { SingleThreadedOperation::SingleThreadedOperation() { this->m_cachedInstance = nullptr; - setComplex(true); + flags.complex = true; } void SingleThreadedOperation::initExecution() diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cc b/source/blender/compositor/intern/COM_WorkScheduler.cc index 6a7de0a1c73..7224078a2c3 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cc +++ b/source/blender/compositor/intern/COM_WorkScheduler.cc @@ -144,7 +144,7 @@ static void opencl_start(CompositorContext &context) static bool opencl_schedule(WorkPackage *package) { - if (package->execution_group->isOpenCL() && g_work_scheduler.opencl.active) { + if (package->execution_group->get_flags().open_cl && g_work_scheduler.opencl.active) { BLI_thread_queue_push(g_work_scheduler.opencl.queue, package); return true; } diff --git a/source/blender/compositor/intern/COM_WorkScheduler.h b/source/blender/compositor/intern/COM_WorkScheduler.h index a8a76944939..758bd8feb26 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.h +++ b/source/blender/compositor/intern/COM_WorkScheduler.h @@ -33,7 +33,7 @@ struct WorkScheduler { /** * \brief schedule a chunk of a group to be calculated. * An execution group schedules a chunk in the WorkScheduler - * when ExecutionGroup.isOpenCL is set the work will be handled by a OpenCLDevice + * when ExecutionGroup.get_flags().open_cl is set the work will be handled by a OpenCLDevice * otherwise the work is scheduled for an CPUDevice * \see ExecutionGroup.execute * \param group: the execution group diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cc b/source/blender/compositor/operations/COM_AntiAliasOperation.cc index 69b44659aaa..23d6f4b80c7 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.cc +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cc @@ -119,7 +119,7 @@ AntiAliasOperation::AntiAliasOperation() this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); this->m_valueReader = nullptr; - this->setComplex(true); + this->flags.complex = true; } void AntiAliasOperation::initExecution() diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cc b/source/blender/compositor/operations/COM_BilateralBlurOperation.cc index 71a2225fc1d..64448e2ae95 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cc +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cc @@ -28,7 +28,7 @@ BilateralBlurOperation::BilateralBlurOperation() this->addInputSocket(DataType::Color); this->addInputSocket(DataType::Color); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputColorProgram = nullptr; this->m_inputDeterminatorProgram = nullptr; diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cc b/source/blender/compositor/operations/COM_BlurBaseOperation.cc index 2e6a3ee9ac4..8b73624ca79 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cc +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cc @@ -30,7 +30,7 @@ BlurBaseOperation::BlurBaseOperation(DataType data_type) this->addInputSocket(data_type); this->addInputSocket(DataType::Value); this->addOutputSocket(data_type); - this->setComplex(true); + this->flags.complex = true; this->m_inputProgram = nullptr; memset(&m_data, 0, sizeof(NodeBlurData)); this->m_size = 1.0f; diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cc b/source/blender/compositor/operations/COM_BokehBlurOperation.cc index 3eb058a10ef..8d331758377 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cc @@ -31,8 +31,9 @@ BokehBlurOperation::BokehBlurOperation() this->addInputSocket(DataType::Value); this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Color); - this->setComplex(true); - this->setOpenCL(true); + + flags.complex = true; + flags.open_cl = true; this->m_size = 1.0f; this->m_sizeavailable = false; diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cc b/source/blender/compositor/operations/COM_CalculateMeanOperation.cc index e3a67cc8574..a7ea49aed8d 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cc +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cc @@ -31,7 +31,7 @@ CalculateMeanOperation::CalculateMeanOperation() this->m_imageReader = nullptr; this->m_iscalculated = false; this->m_setting = 1; - this->setComplex(true); + this->flags.complex = true; } void CalculateMeanOperation::initExecution() { diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cc b/source/blender/compositor/operations/COM_CompositorOperation.cc index b5085d94658..f70b5cc9dad 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cc +++ b/source/blender/compositor/operations/COM_CompositorOperation.cc @@ -52,6 +52,8 @@ CompositorOperation::CompositorOperation() this->m_scene = nullptr; this->m_sceneName[0] = '\0'; this->m_viewName = nullptr; + + flags.use_render_border = true; } void CompositorOperation::initExecution() diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc index 5f550e25a59..72cbbf4283a 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc @@ -31,7 +31,7 @@ ConvolutionFilterOperation::ConvolutionFilterOperation() this->addOutputSocket(DataType::Color); this->setResolutionInputSocketIndex(0); this->m_inputOperation = nullptr; - this->setComplex(true); + this->flags.complex = true; } void ConvolutionFilterOperation::initExecution() { diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.cc b/source/blender/compositor/operations/COM_CryptomatteOperation.cc index 1e59c5adc38..63bbca66296 100644 --- a/source/blender/compositor/operations/COM_CryptomatteOperation.cc +++ b/source/blender/compositor/operations/COM_CryptomatteOperation.cc @@ -27,7 +27,7 @@ CryptomatteOperation::CryptomatteOperation(size_t num_inputs) } inputs.resize(num_inputs); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; } void CryptomatteOperation::initExecution() diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.cc b/source/blender/compositor/operations/COM_DespeckleOperation.cc index aa758c741e5..fc8778c7d2e 100644 --- a/source/blender/compositor/operations/COM_DespeckleOperation.cc +++ b/source/blender/compositor/operations/COM_DespeckleOperation.cc @@ -31,7 +31,7 @@ DespeckleOperation::DespeckleOperation() this->addOutputSocket(DataType::Color); this->setResolutionInputSocketIndex(0); this->m_inputOperation = nullptr; - this->setComplex(true); + this->flags.complex = true; } void DespeckleOperation::initExecution() { diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cc b/source/blender/compositor/operations/COM_DilateErodeOperation.cc index ed857150e42..9e18a8e2f2c 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cc +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cc @@ -29,7 +29,7 @@ DilateErodeThresholdOperation::DilateErodeThresholdOperation() { this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); - this->setComplex(true); + this->flags.complex = true; this->m_inputProgram = nullptr; this->m_inset = 0.0f; this->m__switch = 0.5f; @@ -165,10 +165,10 @@ DilateDistanceOperation::DilateDistanceOperation() { this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); - this->setComplex(true); this->m_inputProgram = nullptr; this->m_distance = 0.0f; - this->setOpenCL(true); + flags.complex = true; + flags.open_cl = true; } void DilateDistanceOperation::initExecution() { @@ -323,7 +323,7 @@ DilateStepOperation::DilateStepOperation() { this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); - this->setComplex(true); + this->flags.complex = true; this->m_inputProgram = nullptr; } void DilateStepOperation::initExecution() diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc index c27852a7a58..97bdc25af3b 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc @@ -29,9 +29,8 @@ DirectionalBlurOperation::DirectionalBlurOperation() { this->addInputSocket(DataType::Color); this->addOutputSocket(DataType::Color); - this->setComplex(true); - - this->setOpenCL(true); + flags.complex = true; + flags.open_cl = true; this->m_inputProgram = nullptr; } diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cc b/source/blender/compositor/operations/COM_DisplaceOperation.cc index 47f11409cbc..9f3f5cfe489 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.cc +++ b/source/blender/compositor/operations/COM_DisplaceOperation.cc @@ -29,7 +29,7 @@ DisplaceOperation::DisplaceOperation() this->addInputSocket(DataType::Value); this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputColorProgram = nullptr; this->m_inputVectorProgram = nullptr; diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc index 7f508ac605e..a3a86a6c502 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc @@ -1317,7 +1317,7 @@ DoubleEdgeMaskOperation::DoubleEdgeMaskOperation() this->m_inputOuterMask = nullptr; this->m_adjacentOnly = false; this->m_keepInside = false; - this->setComplex(true); + this->flags.complex = true; } bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti * /*input*/, diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc index a46d30469d1..6f2ac73d251 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc @@ -266,7 +266,7 @@ FastGaussianBlurValueOperation::FastGaussianBlurValueOperation() this->m_inputprogram = nullptr; this->m_sigma = 1.0f; this->m_overlay = 0; - setComplex(true); + flags.complex = true; } void FastGaussianBlurValueOperation::executePixel(float output[4], int x, int y, void *data) diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h index 6bf439f8e11..15277f0a42d 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h @@ -64,7 +64,7 @@ class GaussianXBlurOperation : public BlurBaseOperation { void checkOpenCL() { - this->setOpenCL(m_data.sizex >= 128); + flags.open_cl = (m_data.sizex >= 128); } }; diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h index d31ad1f6497..56d40849ba4 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h @@ -64,7 +64,7 @@ class GaussianYBlurOperation : public BlurBaseOperation { void checkOpenCL() { - this->setOpenCL(m_data.sizex >= 128); + flags.open_cl = (m_data.sizex >= 128); } }; diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cc b/source/blender/compositor/operations/COM_IDMaskOperation.cc index 576c70f1217..1bb247e9bc5 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.cc +++ b/source/blender/compositor/operations/COM_IDMaskOperation.cc @@ -24,7 +24,7 @@ IDMaskOperation::IDMaskOperation() { this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); - this->setComplex(true); + this->flags.complex = true; } void *IDMaskOperation::initializeTileData(rcti *rect) diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cc b/source/blender/compositor/operations/COM_InpaintOperation.cc index 41773a64d83..ad257611522 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.cc +++ b/source/blender/compositor/operations/COM_InpaintOperation.cc @@ -33,7 +33,7 @@ InpaintSimpleOperation::InpaintSimpleOperation() { this->addInputSocket(DataType::Color); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputImageProgram = nullptr; this->m_pixelorder = nullptr; this->m_manhattan_distance = nullptr; diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.cc b/source/blender/compositor/operations/COM_KeyingBlurOperation.cc index ace035beeaf..994b00cd3f4 100644 --- a/source/blender/compositor/operations/COM_KeyingBlurOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.cc @@ -33,7 +33,7 @@ KeyingBlurOperation::KeyingBlurOperation() this->m_size = 0; this->m_axis = BLUR_AXIS_X; - this->setComplex(true); + this->flags.complex = true; } void *KeyingBlurOperation::initializeTileData(rcti *rect) diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.cc b/source/blender/compositor/operations/COM_KeyingClipOperation.cc index 3c767da30fd..4029be4e077 100644 --- a/source/blender/compositor/operations/COM_KeyingClipOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingClipOperation.cc @@ -38,7 +38,7 @@ KeyingClipOperation::KeyingClipOperation() this->m_isEdgeMatte = false; - this->setComplex(true); + this->flags.complex = true; } void *KeyingClipOperation::initializeTileData(rcti *rect) diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc index 05916b05694..17b613246ad 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc @@ -38,7 +38,7 @@ KeyingScreenOperation::KeyingScreenOperation() this->m_movieClip = nullptr; this->m_framenumber = 0; this->m_trackingObject[0] = 0; - setComplex(true); + flags.complex = true; } void KeyingScreenOperation::initExecution() diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cc b/source/blender/compositor/operations/COM_MapUVOperation.cc index e3c32259e90..74e3d965d41 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cc +++ b/source/blender/compositor/operations/COM_MapUVOperation.cc @@ -27,7 +27,7 @@ MapUVOperation::MapUVOperation() this->addInputSocket(DataType::Vector); this->addOutputSocket(DataType::Color); this->m_alpha = 0.0f; - this->setComplex(true); + this->flags.complex = true; setResolutionInputSocketIndex(1); this->m_inputUVProgram = nullptr; diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cc b/source/blender/compositor/operations/COM_NormalizeOperation.cc index f72841dabda..faacb429f71 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.cc +++ b/source/blender/compositor/operations/COM_NormalizeOperation.cc @@ -26,7 +26,7 @@ NormalizeOperation::NormalizeOperation() this->addOutputSocket(DataType::Value); this->m_imageReader = nullptr; this->m_cachedInstance = nullptr; - this->setComplex(true); + this->flags.complex = true; } void NormalizeOperation::initExecution() { diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h index 5027f03ec27..81277ab1ef3 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileOperation.h @@ -70,11 +70,6 @@ class OutputSingleLayerOperation : public NodeOperation { { return CompositorPriority::Low; } - - bool isFileOutputOperation() const override - { - return true; - } }; /* extra info for OpenEXR layers */ @@ -129,11 +124,6 @@ class OutputOpenExrMultiLayerOperation : public NodeOperation { { return CompositorPriority::Low; } - - bool isFileOutputOperation() const override - { - return true; - } }; void add_exr_channels(void *exrhandle, diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cc b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cc index af270c4515a..3577860b93d 100644 --- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cc @@ -100,7 +100,7 @@ PlaneCornerPinMaskOperation::PlaneCornerPinMaskOperation() : m_corners_ready(fal * so we can use the initializeTileData function * to read corners from input sockets ... */ - setComplex(true); + flags.complex = true; } void PlaneCornerPinMaskOperation::initExecution() diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc index 1e92bbad036..46ae00dee34 100644 --- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc @@ -53,7 +53,7 @@ PlaneDistortWarpImageOperation::PlaneDistortWarpImageOperation() this->m_pixelReader = nullptr; this->m_motion_blur_samples = 1; this->m_motion_blur_shutter = 0.5f; - this->setComplex(true); + this->flags.complex = true; } void PlaneDistortWarpImageOperation::calculateCorners(const float corners[4][2], diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cc b/source/blender/compositor/operations/COM_PreviewOperation.cc index 7d996619fdc..fd30f2fc610 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cc +++ b/source/blender/compositor/operations/COM_PreviewOperation.cc @@ -50,6 +50,7 @@ PreviewOperation::PreviewOperation(const ColorManagedViewSettings *viewSettings, this->m_displaySettings = displaySettings; this->m_defaultWidth = defaultWidth; this->m_defaultHeight = defaultHeight; + flags.use_viewer_border = true; } void PreviewOperation::verifyPreview(bNodeInstanceHash *previews, bNodeInstanceKey key) diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc index 31fb98e22fd..93702d3f0cf 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc @@ -27,7 +27,7 @@ ProjectorLensDistortionOperation::ProjectorLensDistortionOperation() this->addInputSocket(DataType::Color); this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputProgram = nullptr; this->m_dispersionAvailable = false; this->m_dispersion = 0.0f; diff --git a/source/blender/compositor/operations/COM_SMAAOperation.cc b/source/blender/compositor/operations/COM_SMAAOperation.cc index e99690001ea..38700c76f07 100644 --- a/source/blender/compositor/operations/COM_SMAAOperation.cc +++ b/source/blender/compositor/operations/COM_SMAAOperation.cc @@ -163,7 +163,7 @@ SMAAEdgeDetectionOperation::SMAAEdgeDetectionOperation() this->addInputSocket(DataType::Color); /* image */ this->addInputSocket(DataType::Value); /* depth, material ID, etc. */ this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_imageReader = nullptr; this->m_valueReader = nullptr; this->m_threshold = 0.1f; @@ -295,7 +295,7 @@ SMAABlendingWeightCalculationOperation::SMAABlendingWeightCalculationOperation() { this->addInputSocket(DataType::Color); /* edges */ this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_imageReader = nullptr; this->m_corner_rounding = 25; } @@ -782,7 +782,7 @@ SMAANeighborhoodBlendingOperation::SMAANeighborhoodBlendingOperation() this->addInputSocket(DataType::Color); /* image */ this->addInputSocket(DataType::Color); /* blend */ this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_image1Reader = nullptr; this->m_image2Reader = nullptr; } diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc index ff066eba8a0..634fe66b0dd 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc @@ -32,7 +32,7 @@ ScreenLensDistortionOperation::ScreenLensDistortionOperation() this->addInputSocket(DataType::Value); this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputProgram = nullptr; this->m_distortion = 0.0f; this->m_dispersion = 0.0f; diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cc b/source/blender/compositor/operations/COM_SunBeamsOperation.cc index 85393cb13e4..085a0bb571c 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.cc +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cc @@ -27,7 +27,7 @@ SunBeamsOperation::SunBeamsOperation() this->addOutputSocket(DataType::Color); this->setResolutionInputSocketIndex(0); - this->setComplex(true); + this->flags.complex = true; } void SunBeamsOperation::initExecution() diff --git a/source/blender/compositor/operations/COM_TextureOperation.cc b/source/blender/compositor/operations/COM_TextureOperation.cc index 3a7a18d47ff..e94c457f981 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cc +++ b/source/blender/compositor/operations/COM_TextureOperation.cc @@ -37,7 +37,7 @@ TextureBaseOperation::TextureBaseOperation() this->m_rd = nullptr; this->m_pool = nullptr; this->m_sceneColorManage = false; - setComplex(true); + flags.complex = true; } TextureOperation::TextureOperation() : TextureBaseOperation() { diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cc b/source/blender/compositor/operations/COM_TonemapOperation.cc index f2709398b75..6bfacb0c75d 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.cc +++ b/source/blender/compositor/operations/COM_TonemapOperation.cc @@ -31,7 +31,7 @@ TonemapOperation::TonemapOperation() this->m_imageReader = nullptr; this->m_data = nullptr; this->m_cachedInstance = nullptr; - this->setComplex(true); + this->flags.complex = true; } void TonemapOperation::initExecution() { diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc index 2b81ac6a70c..6f4ba2d5af1 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc @@ -34,8 +34,8 @@ VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() ResizeMode::None); // inverse search radius optimization structure. #endif this->addOutputSocket(DataType::Color); - this->setComplex(true); - this->setOpenCL(true); + flags.complex = true; + flags.open_cl = true; this->m_inputProgram = nullptr; this->m_inputBokehProgram = nullptr; @@ -282,7 +282,7 @@ InverseSearchRadiusOperation::InverseSearchRadiusOperation() { this->addInputSocket(DataType::Value, ResizeMode::None); // radius this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputRadius = nullptr; } diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cc b/source/blender/compositor/operations/COM_VectorBlurOperation.cc index 74621eaacf6..c32075a5fd4 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cc @@ -56,7 +56,7 @@ VectorBlurOperation::VectorBlurOperation() this->m_inputImageProgram = nullptr; this->m_inputSpeedProgram = nullptr; this->m_inputZProgram = nullptr; - setComplex(true); + flags.complex = true; } void VectorBlurOperation::initExecution() { diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc index e19e7fa6cb9..dc52a91ef87 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cc +++ b/source/blender/compositor/operations/COM_ViewerOperation.cc @@ -55,6 +55,7 @@ ViewerOperation::ViewerOperation() this->m_depthInput = nullptr; this->m_rd = nullptr; this->m_viewName = nullptr; + flags.use_viewer_border = true; } void ViewerOperation::initExecution() diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cc b/source/blender/compositor/operations/COM_WriteBufferOperation.cc index 7a24ed83b4d..3c0f3b3f3e7 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cc +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cc @@ -63,7 +63,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/ MemoryBuffer *memoryBuffer = this->m_memoryProxy->getBuffer(); float *buffer = memoryBuffer->getBuffer(); const uint8_t num_channels = memoryBuffer->get_num_channels(); - if (this->m_input->isComplex()) { + if (this->m_input->get_flags().complex) { void *data = this->m_input->initializeTileData(rect); int x1 = rect->xmin; int y1 = rect->ymin; -- cgit v1.2.3