diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-12-09 12:01:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-12-09 12:01:49 +0300 |
commit | 8aed5dbcf8e05675be8128b6197026e480622254 (patch) | |
tree | 9b5dfea6aff40bfcd61bac406ca6d9450c07ee7a /source/blender | |
parent | 7c76bdca1b7195720a769c4911678d85825907fe (diff) |
Cleanup: move public doc-strings into headers for 'compositor'
Ref T92709
Diffstat (limited to 'source/blender')
32 files changed, 149 insertions, 143 deletions
diff --git a/source/blender/compositor/intern/COM_ConstantFolder.cc b/source/blender/compositor/intern/COM_ConstantFolder.cc index 2cf3ac001d1..ca5fd9e8274 100644 --- a/source/blender/compositor/intern/COM_ConstantFolder.cc +++ b/source/blender/compositor/intern/COM_ConstantFolder.cc @@ -30,10 +30,6 @@ namespace blender::compositor { using Link = NodeOperationBuilder::Link; -/** - * \param operations_builder: Contains all operations to fold. - * \param exec_system: Execution system. - */ ConstantFolder::ConstantFolder(NodeOperationBuilder &operations_builder) : operations_builder_(operations_builder) { @@ -135,7 +131,6 @@ Vector<MemoryBuffer *> ConstantFolder::get_constant_input_buffers(NodeOperation return inputs_bufs; } -/** Returns constant operations resulted from folded operations. */ Vector<ConstantOperation *> ConstantFolder::try_fold_operations(Span<NodeOperation *> operations) { Set<NodeOperation *> foldable_ops = find_constant_foldable_operations(operations); @@ -151,9 +146,6 @@ Vector<ConstantOperation *> ConstantFolder::try_fold_operations(Span<NodeOperati return new_folds; } -/** - * Evaluate operations with constant elements into primitive constant operations. - */ int ConstantFolder::fold_operations() { WorkScheduler::start(operations_builder_.context()); diff --git a/source/blender/compositor/intern/COM_ConstantFolder.h b/source/blender/compositor/intern/COM_ConstantFolder.h index f31cb4f4e78..972dbf0e125 100644 --- a/source/blender/compositor/intern/COM_ConstantFolder.h +++ b/source/blender/compositor/intern/COM_ConstantFolder.h @@ -42,10 +42,18 @@ class ConstantFolder { rcti first_elem_area_; public: + /** + * \param operations_builder: Contains all operations to fold. + * \param exec_system: Execution system. + */ ConstantFolder(NodeOperationBuilder &operations_builder); + /** + * Evaluate operations with constant elements into primitive constant operations. + */ int fold_operations(); private: + /** Returns constant operations resulted from folded operations. */ Vector<ConstantOperation *> try_fold_operations(Span<NodeOperation *> operations); ConstantOperation *fold_operation(NodeOperation *operation); diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc index d2198fc14e8..63ca642d52d 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cc +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc @@ -302,10 +302,6 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const return chunk_order; } -/** - * this method is called for the top execution groups. containing the compositor node or the - * preview node or the viewer node) - */ void ExecutionGroup::execute(ExecutionSystem *graph) { const CompositorContext &context = graph->get_context(); diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h index ce5e9dd4699..430cde89a3b 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.h +++ b/source/blender/compositor/intern/COM_ExecutionGroup.h @@ -365,6 +365,10 @@ class ExecutionGroup { * \see ViewerOperation * \param graph: */ + /** + * This method is called for the top execution groups. containing the compositor node or the + * preview node or the viewer node). + */ void execute(ExecutionSystem *graph); /** diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cc b/source/blender/compositor/intern/COM_ExecutionSystem.cc index 82821a1ddb1..038df6ed9df 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cc +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cc @@ -118,9 +118,6 @@ void ExecutionSystem::execute() execution_model_->execute(*this); } -/** - * Multi-threadedly execute given work function passing work_rect splits as argument. - */ void ExecutionSystem::execute_work(const rcti &work_rect, std::function<void(const rcti &split_rect)> work_func) { diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h index 4a3fecaca47..4456ec107fa 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.h +++ b/source/blender/compositor/intern/COM_ExecutionSystem.h @@ -208,6 +208,9 @@ class ExecutionSystem { return active_buffers_; } + /** + * Multi-threadedly execute given work function passing work_rect splits as argument. + */ void execute_work(const rcti &work_rect, std::function<void(const rcti &split_rect)> work_func); /** diff --git a/source/blender/compositor/intern/COM_FullFrameExecutionModel.cc b/source/blender/compositor/intern/COM_FullFrameExecutionModel.cc index 1295437785f..15dbbfde7ed 100644 --- a/source/blender/compositor/intern/COM_FullFrameExecutionModel.cc +++ b/source/blender/compositor/intern/COM_FullFrameExecutionModel.cc @@ -73,10 +73,6 @@ void FullFrameExecutionModel::determine_areas_to_render_and_reads() } } -/** - * Returns input buffers with an offset relative to given output coordinates. Returned memory - * buffers must be deleted. - */ Vector<MemoryBuffer *> FullFrameExecutionModel::get_input_buffers(NodeOperation *op, const int output_x, const int output_y) @@ -137,9 +133,6 @@ void FullFrameExecutionModel::render_operation(NodeOperation *op) operation_finished(op); } -/** - * Render output operations in order of priority. - */ void FullFrameExecutionModel::render_operations() { const bool is_rendering = context_.is_rendering(); @@ -200,9 +193,6 @@ void FullFrameExecutionModel::render_output_dependencies(NodeOperation *output_o } } -/** - * Determines all operations areas needed to render given output area. - */ void FullFrameExecutionModel::determine_areas_to_render(NodeOperation *output_op, const rcti &output_area) { @@ -235,10 +225,6 @@ void FullFrameExecutionModel::determine_areas_to_render(NodeOperation *output_op } } -/** - * Determines reads to receive by operations in output operation tree (i.e: Number of dependent - * operations each operation has). - */ void FullFrameExecutionModel::determine_reads(NodeOperation *output_op) { BLI_assert(output_op->is_output_operation(context_.is_rendering())); @@ -258,10 +244,6 @@ void FullFrameExecutionModel::determine_reads(NodeOperation *output_op) } } -/** - * Calculates given output operation area to be rendered taking into account viewer and render - * borders. - */ void FullFrameExecutionModel::get_output_render_area(NodeOperation *output_op, rcti &r_area) { BLI_assert(output_op->is_output_operation(context_.is_rendering())); diff --git a/source/blender/compositor/intern/COM_FullFrameExecutionModel.h b/source/blender/compositor/intern/COM_FullFrameExecutionModel.h index 36d42886c27..ce724a6b934 100644 --- a/source/blender/compositor/intern/COM_FullFrameExecutionModel.h +++ b/source/blender/compositor/intern/COM_FullFrameExecutionModel.h @@ -42,8 +42,8 @@ class SharedOperationBuffers; class FullFrameExecutionModel : public ExecutionModel { private: /** - * Contains operations active buffers data. Buffers will be disposed once reader operations are - * finished. + * Contains operations active buffers data. + * Buffers will be disposed once reader operations are finished. */ SharedOperationBuffers &active_buffers_; @@ -66,8 +66,15 @@ class FullFrameExecutionModel : public ExecutionModel { private: void determine_areas_to_render_and_reads(); + /** + * Render output operations in order of priority. + */ void render_operations(); void render_output_dependencies(NodeOperation *output_op); + /** + * Returns input buffers with an offset relative to given output coordinates. + * Returned memory buffers must be deleted. + */ Vector<MemoryBuffer *> get_input_buffers(NodeOperation *op, const int output_x, const int output_y); @@ -76,8 +83,19 @@ class FullFrameExecutionModel : public ExecutionModel { void operation_finished(NodeOperation *operation); + /** + * Calculates given output operation area to be rendered taking into account viewer and render + * borders. + */ void get_output_render_area(NodeOperation *output_op, rcti &r_area); + /** + * Determines all operations areas needed to render given output area. + */ void determine_areas_to_render(NodeOperation *output_op, const rcti &output_area); + /** + * Determines reads to receive by operations in output operation tree (i.e: Number of dependent + * operations each operation has). + */ void determine_reads(NodeOperation *output_op); void update_progress_bar(); diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc index 96888ea1c96..ae925f796ee 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cc +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc @@ -74,20 +74,12 @@ MemoryBuffer::MemoryBuffer(DataType data_type, const rcti &rect, bool is_a_singl set_strides(); } -/** - * Construct MemoryBuffer from a float buffer. MemoryBuffer is not responsible for - * freeing it. - */ MemoryBuffer::MemoryBuffer( float *buffer, int num_channels, int width, int height, bool is_a_single_elem) : MemoryBuffer(buffer, num_channels, create_rect(width, height), is_a_single_elem) { } -/** - * Construct MemoryBuffer from a float buffer area. MemoryBuffer is not responsible for - * freeing given buffer. - */ MemoryBuffer::MemoryBuffer(float *buffer, const int num_channels, const rcti &rect, @@ -145,10 +137,6 @@ BuffersIterator<float> MemoryBuffer::iterate_with(Span<MemoryBuffer *> inputs, c return builder.build(); } -/** - * Converts a single elem buffer to a full size buffer (allocates memory for all - * elements in resolution). - */ MemoryBuffer *MemoryBuffer::inflate() const { BLI_assert(is_a_single_elem()); diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 33d78c99ca6..1af047e9ce1 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -132,9 +132,17 @@ class MemoryBuffer { */ MemoryBuffer(DataType data_type, const rcti &rect, bool is_a_single_elem = false); + /** + * Construct MemoryBuffer from a float buffer. MemoryBuffer is not responsible for + * freeing it. + */ MemoryBuffer( float *buffer, int num_channels, int width, int height, bool is_a_single_elem = false); + /** + * Construct MemoryBuffer from a float buffer area. MemoryBuffer is not responsible for + * freeing given buffer. + */ MemoryBuffer(float *buffer, int num_channels, const rcti &rect, bool is_a_single_elem = false); /** @@ -377,6 +385,10 @@ class MemoryBuffer { return buffer_; } + /** + * Converts a single elem buffer to a full size buffer (allocates memory for all + * elements in resolution). + */ MemoryBuffer *inflate() const; inline void wrap_pixel(int &x, int &y, MemoryBufferExtend extend_x, MemoryBufferExtend extend_y) diff --git a/source/blender/compositor/intern/COM_MetaData.cc b/source/blender/compositor/intern/COM_MetaData.cc index 530634a6e41..50561975ae4 100644 --- a/source/blender/compositor/intern/COM_MetaData.cc +++ b/source/blender/compositor/intern/COM_MetaData.cc @@ -36,10 +36,6 @@ void MetaData::add_cryptomatte_entry(const blender::StringRef layer_name, add(blender::bke::cryptomatte::BKE_cryptomatte_meta_data_key(layer_name, key), value); } -/* Replace the hash neutral cryptomatte keys with hashed versions. - * - * When a conversion happens it will also add the cryptomatte name key with the given - * `layer_name`. */ void MetaData::replace_hash_neutral_cryptomatte_keys(const blender::StringRef layer_name) { std::string cryptomatte_hash = entries_.pop_default(META_DATA_KEY_CRYPTOMATTE_HASH, ""); diff --git a/source/blender/compositor/intern/COM_MetaData.h b/source/blender/compositor/intern/COM_MetaData.h index 0bb014525c3..be47d7c281e 100644 --- a/source/blender/compositor/intern/COM_MetaData.h +++ b/source/blender/compositor/intern/COM_MetaData.h @@ -50,6 +50,12 @@ class MetaData { public: void add(const blender::StringRef key, const blender::StringRef value); + /** + * Replace the hash neutral cryptomatte keys with hashed versions. + * + * When a conversion happens it will also add the cryptomatte name key with the given + * `layer_name`. + */ void replace_hash_neutral_cryptomatte_keys(const blender::StringRef layer_name); void add_to_render_result(RenderResult *render_result) const; #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/blender/compositor/intern/COM_NodeOperation.cc b/source/blender/compositor/intern/COM_NodeOperation.cc index 3050d82bf62..1f8bc542843 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cc +++ b/source/blender/compositor/intern/COM_NodeOperation.cc @@ -37,14 +37,12 @@ NodeOperation::NodeOperation() btree_ = nullptr; } -/** Get constant value when operation is constant, otherwise return default_value. */ float NodeOperation::get_constant_value_default(float default_value) { BLI_assert(outputs_.size() > 0 && get_output_socket()->get_data_type() == DataType::Value); return *get_constant_elem_default(&default_value); } -/** Get constant elem when operation is constant, otherwise return default_elem. */ const float *NodeOperation::get_constant_elem_default(const float *default_elem) { BLI_assert(outputs_.size() > 0); @@ -55,11 +53,6 @@ const float *NodeOperation::get_constant_elem_default(const float *default_elem) return default_elem; } -/** - * Generate a hash that identifies the operation result in the current execution. - * Requires `hash_output_params` to be implemented, otherwise `std::nullopt` is returned. - * If the operation parameters or its linked inputs change, the hash must be re-generated. - */ std::optional<NodeOperationHash> NodeOperation::generate_hash() { params_hash_ = get_default_hash_2(canvas_.xmin, canvas_.xmax); @@ -213,10 +206,6 @@ const rcti &NodeOperation::get_canvas() const return canvas_; } -/** - * Mainly used for re-determining canvas of constant operations in cases where preferred canvas - * depends on the constant element. - */ void NodeOperation::unset_canvas() { BLI_assert(inputs_.size() == 0); @@ -275,18 +264,6 @@ bool NodeOperation::determine_depending_area_of_interest(rcti *input, /** \name Full Frame Methods * \{ */ -/** - * \brief Get input operation area being read by this operation on rendering given output area. - * - * Implementation don't need to ensure r_input_area is within input operation bounds. The - * caller must clamp it. - * TODO: See if it's possible to use parameter overloading (input_id for example). - * - * \param input_idx: Input operation index for which we want to calculate the area being read. - * \param output_area: Area being rendered by this operation. - * \param r_input_area: Returned input operation area that needs to be read in order to render - * given output area. - */ void NodeOperation::get_area_of_interest(const int input_idx, const rcti &output_area, rcti &r_input_area) @@ -315,12 +292,6 @@ void NodeOperation::get_area_of_interest(NodeOperation *input_op, BLI_assert_msg(0, "input_op is not an input operation."); } -/** - * Executes operation image manipulation algorithm rendering given areas. - * \param output_buf: Buffer to write result to. - * \param areas: Areas within this operation bounds to render. - * \param inputs_bufs: Inputs operations buffers. - */ void NodeOperation::render(MemoryBuffer *output_buf, Span<rcti> areas, Span<MemoryBuffer *> inputs_bufs) @@ -333,9 +304,6 @@ void NodeOperation::render(MemoryBuffer *output_buf, } } -/** - * Renders given areas using operations full frame implementation. - */ void NodeOperation::render_full_frame(MemoryBuffer *output_buf, Span<rcti> areas, Span<MemoryBuffer *> inputs_bufs) @@ -347,9 +315,6 @@ void NodeOperation::render_full_frame(MemoryBuffer *output_buf, deinit_execution(); } -/** - * Renders given areas using operations tiled implementation. - */ void NodeOperation::render_full_frame_fallback(MemoryBuffer *output_buf, Span<rcti> areas, Span<MemoryBuffer *> inputs_bufs) @@ -405,9 +370,6 @@ void NodeOperation::render_tile(MemoryBuffer *output_buf, rcti *tile_rect) } } -/** - * \return Replaced inputs links. - */ Vector<NodeOperationOutput *> NodeOperation::replace_inputs_with_buffers( Span<MemoryBuffer *> inputs_bufs) { @@ -461,9 +423,6 @@ SocketReader *NodeOperationInput::get_reader() return nullptr; } -/** - * \return Whether canvas area could be determined. - */ bool NodeOperationInput::determine_canvas(const rcti &preferred_area, rcti &r_area) { if (link_) { diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index e969d836464..4412c021517 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -134,6 +134,9 @@ class NodeOperationInput { SocketReader *get_reader(); + /** + * \return Whether canvas area could be determined. + */ bool determine_canvas(const rcti &preferred_area, rcti &r_area); #ifdef WITH_CXX_GUARDEDALLOC @@ -385,7 +388,9 @@ class NodeOperation { return id_; } + /** Get constant value when operation is constant, otherwise return default_value. */ float get_constant_value_default(float default_value); + /** Get constant elem when operation is constant, otherwise return default_elem. */ const float *get_constant_elem_default(const float *default_elem); const NodeOperationFlags get_flags() const @@ -393,6 +398,11 @@ class NodeOperation { return flags_; } + /** + * Generate a hash that identifies the operation result in the current execution. + * Requires `hash_output_params` to be implemented, otherwise `std::nullopt` is returned. + * If the operation parameters or its linked inputs change, the hash must be re-generated. + */ std::optional<NodeOperationHash> generate_hash(); unsigned int get_number_of_input_sockets() const @@ -511,6 +521,10 @@ class NodeOperation { void set_canvas(const rcti &canvas_area); const rcti &get_canvas() const; + /** + * Mainly used for re-determining canvas of constant operations in cases where preferred canvas + * depends on the constant element. + */ void unset_canvas(); /** @@ -618,6 +632,12 @@ class NodeOperation { /** \name Full Frame Methods * \{ */ + /** + * Executes operation image manipulation algorithm rendering given areas. + * \param output_buf: Buffer to write result to. + * \param areas: Areas within this operation bounds to render. + * \param inputs_bufs: Inputs operations buffers. + */ void render(MemoryBuffer *output_buf, Span<rcti> areas, Span<MemoryBuffer *> inputs_bufs); /** @@ -630,7 +650,16 @@ class NodeOperation { } /** - * Get input operation area being read by this operation on rendering given output area. + * \brief Get input operation area being read by this operation on rendering given output area. + * + * Implementation don't need to ensure r_input_area is within input operation bounds. + * The caller must clamp it. + * TODO: See if it's possible to use parameter overloading (input_id for example). + * + * \param input_idx: Input operation index for which we want to calculate the area being read. + * \param output_area: Area being rendered by this operation. + * \param r_input_area: Returned input operation area that needs to be read in order to render + * given output area. */ virtual void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area); void get_area_of_interest(NodeOperation *input_op, const rcti &output_area, rcti &r_input_area); @@ -749,14 +778,23 @@ class NodeOperation { /** \name Full Frame Methods * \{ */ + /** + * Renders given areas using operations full frame implementation. + */ void render_full_frame(MemoryBuffer *output_buf, Span<rcti> areas, Span<MemoryBuffer *> inputs_bufs); + /** + * Renders given areas using operations tiled implementation. + */ void render_full_frame_fallback(MemoryBuffer *output_buf, Span<rcti> areas, Span<MemoryBuffer *> inputs); void render_tile(MemoryBuffer *output_buf, rcti *tile_rect); + /** + * \return Replaced inputs links. + */ Vector<NodeOperationOutput *> replace_inputs_with_buffers(Span<MemoryBuffer *> inputs_bufs); void remove_buffers_and_restore_original_inputs( Span<NodeOperationOutput *> original_inputs_links); diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc index 5dc66fea670..2109dd9c582 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc @@ -481,7 +481,6 @@ static Vector<NodeOperationHash> generate_hashes(Span<NodeOperation *> operation return hashes; } -/** Merge operations with same type, inputs and parameters that produce the same result. */ void NodeOperationBuilder::merge_equal_operations() { bool check_for_next_merge = true; @@ -793,7 +792,6 @@ void NodeOperationBuilder::save_graphviz(StringRefNull name) } } -/** Create a graphviz representation of the NodeOperationBuilder. */ std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder &builder) { os << "# Builder start\n"; diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.h b/source/blender/compositor/intern/COM_NodeOperationBuilder.h index fcb2dd3800e..efc927e7c9e 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.h +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.h @@ -169,6 +169,7 @@ class NodeOperationBuilder { private: PreviewOperation *make_preview_operation() const; void unlink_inputs_and_relink_outputs(NodeOperation *unlinked_op, NodeOperation *linked_op); + /** Merge operations with same type, inputs and parameters that produce the same result. */ void merge_equal_operations(); void merge_equal_operations(NodeOperation *from, NodeOperation *into); void save_graphviz(StringRefNull name = ""); @@ -177,6 +178,7 @@ class NodeOperationBuilder { #endif }; +/** Create a graphviz representation of the NodeOperationBuilder. */ std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder &builder); std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder::Link &link); diff --git a/source/blender/compositor/intern/COM_SharedOperationBuffers.cc b/source/blender/compositor/intern/COM_SharedOperationBuffers.cc index c67251b2d20..567b5e0ee53 100644 --- a/source/blender/compositor/intern/COM_SharedOperationBuffers.cc +++ b/source/blender/compositor/intern/COM_SharedOperationBuffers.cc @@ -31,13 +31,11 @@ SharedOperationBuffers::BufferData &SharedOperationBuffers::get_buffer_data(Node return buffers_.lookup_or_add_cb(op, []() { return BufferData(); }); } -/** - * Whether given operation area to render is already registered. - * TODO: Possibly refactor to "request_area". Current implementation is incomplete: partial - * overlapping, etc. Leading to more rendering than necessary. - */ bool SharedOperationBuffers::is_area_registered(NodeOperation *op, const rcti &area_to_render) { + /* TODO: Possibly refactor to "request_area". Current implementation is incomplete: + * partial overlapping, etc. Leading to more rendering than necessary. */ + BufferData &buf_data = get_buffer_data(op); for (rcti ®_rect : buf_data.render_areas) { if (BLI_rcti_inside_rcti(®_rect, &area_to_render)) { @@ -47,34 +45,21 @@ bool SharedOperationBuffers::is_area_registered(NodeOperation *op, const rcti &a return false; } -/** - * Registers an operation area to render. - */ void SharedOperationBuffers::register_area(NodeOperation *op, const rcti &area_to_render) { get_buffer_data(op).render_areas.append(area_to_render); } -/** - * Whether given operation has any registered reads (other operation registered it depends on given - * operation). - */ bool SharedOperationBuffers::has_registered_reads(NodeOperation *op) { return get_buffer_data(op).registered_reads > 0; } -/** - * Registers an operation read (other operation depends on given operation). - */ void SharedOperationBuffers::register_read(NodeOperation *read_op) { get_buffer_data(read_op).registered_reads++; } -/** - * Get registered areas given operation needs to render. - */ Vector<rcti> SharedOperationBuffers::get_areas_to_render(NodeOperation *op, const int offset_x, const int offset_y) @@ -88,17 +73,11 @@ Vector<rcti> SharedOperationBuffers::get_areas_to_render(NodeOperation *op, return dst_areas; } -/** - * Whether this operation buffer has already been rendered. - */ bool SharedOperationBuffers::is_operation_rendered(NodeOperation *op) { return get_buffer_data(op).is_rendered; } -/** - * Stores given operation rendered buffer. - */ void SharedOperationBuffers::set_rendered_buffer(NodeOperation *op, std::unique_ptr<MemoryBuffer> buffer) { @@ -109,19 +88,12 @@ void SharedOperationBuffers::set_rendered_buffer(NodeOperation *op, buf_data.is_rendered = true; } -/** - * Get given operation rendered buffer. - */ MemoryBuffer *SharedOperationBuffers::get_rendered_buffer(NodeOperation *op) { BLI_assert(is_operation_rendered(op)); return get_buffer_data(op).buffer.get(); } -/** - * Reports an operation has finished reading given operation. If all given operation dependencies - * have finished its buffer will be disposed. - */ void SharedOperationBuffers::read_finished(NodeOperation *read_op) { BufferData &buf_data = get_buffer_data(read_op); diff --git a/source/blender/compositor/intern/COM_SharedOperationBuffers.h b/source/blender/compositor/intern/COM_SharedOperationBuffers.h index d7d0dffabb5..fd053fce02f 100644 --- a/source/blender/compositor/intern/COM_SharedOperationBuffers.h +++ b/source/blender/compositor/intern/COM_SharedOperationBuffers.h @@ -50,17 +50,46 @@ class SharedOperationBuffers { blender::Map<NodeOperation *, BufferData> buffers_; public: + /** + * Whether given operation area to render is already registered. + */ bool is_area_registered(NodeOperation *op, const rcti &area_to_render); + /** + * Registers an operation area to render. + */ void register_area(NodeOperation *op, const rcti &area_to_render); + /** + * Whether given operation has any registered reads (other operation registered it depends on + * given operation). + */ bool has_registered_reads(NodeOperation *op); + /** + * Registers an operation read (other operation depends on given operation). + */ void register_read(NodeOperation *read_op); + /** + * Get registered areas given operation needs to render. + */ Vector<rcti> get_areas_to_render(NodeOperation *op, int offset_x, int offset_y); + /** + * Whether this operation buffer has already been rendered. + */ bool is_operation_rendered(NodeOperation *op); + /** + * Stores given operation rendered buffer. + */ void set_rendered_buffer(NodeOperation *op, std::unique_ptr<MemoryBuffer> buffer); + /** + * Get given operation rendered buffer. + */ MemoryBuffer *get_rendered_buffer(NodeOperation *op); + /** + * Reports an operation has finished reading given operation. If all given operation dependencies + * have finished its buffer will be disposed. + */ void read_finished(NodeOperation *read_op); private: diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cc b/source/blender/compositor/operations/COM_BlurBaseOperation.cc index aefe74a7e26..702733498c8 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cc +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cc @@ -111,8 +111,6 @@ __m128 *BlurBaseOperation::convert_gausstab_sse(const float *gausstab, int size) } #endif -/* normalized distance from the current (inverted so 1.0 is close and 0.0 is far) - * 'ease' is applied after, looks nicer */ float *BlurBaseOperation::make_dist_fac_inverse(float rad, int size, int falloff) { float *dist_fac_invert, val; diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h index ab378983100..e12c5427082 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h @@ -41,6 +41,10 @@ class BlurBaseOperation : public MultiThreadedOperation, public QualityStepHelpe #ifdef BLI_HAVE_SSE2 __m128 *convert_gausstab_sse(const float *gausstab, int size); #endif + /** + * Normalized distance from the current (inverted so 1.0 is close and 0.0 is far) + * 'ease' is applied after, looks nicer. + */ float *make_dist_fac_inverse(float rad, int size, int falloff); void update_size(); diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cc b/source/blender/compositor/operations/COM_DilateErodeOperation.cc index 2abc4f71b5e..3aaf402ae24 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cc +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cc @@ -21,7 +21,6 @@ namespace blender::compositor { -/* DilateErode Distance Threshold */ DilateErodeThresholdOperation::DilateErodeThresholdOperation() { this->add_input_socket(DataType::Value); @@ -268,7 +267,6 @@ void DilateErodeThresholdOperation::update_memory_buffer_partial(MemoryBuffer *o } } -/* Dilate Distance. */ DilateDistanceOperation::DilateDistanceOperation() { this->add_input_socket(DataType::Value); @@ -458,7 +456,6 @@ void DilateDistanceOperation::update_memory_buffer_partial(MemoryBuffer *output, } } -/* Erode Distance */ ErodeDistanceOperation::ErodeDistanceOperation() : DilateDistanceOperation() { /* pass */ @@ -531,7 +528,6 @@ void ErodeDistanceOperation::update_memory_buffer_partial(MemoryBuffer *output, } } -/* Dilate step */ DilateStepOperation::DilateStepOperation() { this->add_input_socket(DataType::Value); @@ -809,7 +805,6 @@ void DilateStepOperation::update_memory_buffer_partial(MemoryBuffer *output, step_update_memory_buffer<Max2Selector>(output, inputs[0], area, iterations_, -FLT_MAX); } -/* Erode step */ ErodeStepOperation::ErodeStepOperation() : DilateStepOperation() { /* pass */ diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.h b/source/blender/compositor/operations/COM_DilateErodeOperation.h index 04d25a1fca6..2ca6431862d 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.h +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.h @@ -43,6 +43,7 @@ class DilateErodeThresholdOperation : public MultiThreadedOperation { int scope_; public: + /* DilateErode Distance Threshold */ DilateErodeThresholdOperation(); /** @@ -98,6 +99,7 @@ class DilateDistanceOperation : public MultiThreadedOperation { int scope_; public: + /* Dilate Distance. */ DilateDistanceOperation(); /** @@ -140,6 +142,7 @@ class DilateDistanceOperation : public MultiThreadedOperation { class ErodeDistanceOperation : public DilateDistanceOperation { public: + /* Erode Distance */ ErodeDistanceOperation(); /** @@ -169,6 +172,7 @@ class DilateStepOperation : public MultiThreadedOperation { int iterations_; public: + /* Dilate step */ DilateStepOperation(); /** @@ -205,6 +209,7 @@ class DilateStepOperation : public MultiThreadedOperation { class ErodeStepOperation : public DilateStepOperation { public: + /** Erode step. */ ErodeStepOperation(); void *initialize_tile_data(rcti *rect) override; diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cc b/source/blender/compositor/operations/COM_InpaintOperation.cc index 2d632bb3681..83bc81d35fc 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.cc +++ b/source/blender/compositor/operations/COM_InpaintOperation.cc @@ -25,7 +25,6 @@ namespace blender::compositor { #define ASSERT_XY_RANGE(x, y) \ BLI_assert(x >= 0 && x < this->get_width() && y >= 0 && y < this->get_height()) -/* In-paint (simple convolve using average of known pixels). */ InpaintSimpleOperation::InpaintSimpleOperation() { this->add_input_socket(DataType::Color); diff --git a/source/blender/compositor/operations/COM_InpaintOperation.h b/source/blender/compositor/operations/COM_InpaintOperation.h index b0d44e22b85..989d154dab5 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.h +++ b/source/blender/compositor/operations/COM_InpaintOperation.h @@ -39,6 +39,7 @@ class InpaintSimpleOperation : public NodeOperation { short *manhattan_distance_; public: + /** In-paint (simple convolve using average of known pixels). */ InpaintSimpleOperation(); /** diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cc b/source/blender/compositor/operations/COM_RenderLayersProg.cc index 7650def2c87..d8e73b7c979 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cc +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cc @@ -263,6 +263,7 @@ void RenderLayersProg::update_memory_buffer_partial(MemoryBuffer *output, } /* ******** Render Layers AO Operation ******** */ + void RenderLayersAOOperation::execute_pixel_sampled(float output[4], float x, float y, @@ -294,6 +295,7 @@ void RenderLayersAOOperation::update_memory_buffer_partial(MemoryBuffer *output, } /* ******** Render Layers Alpha Operation ******** */ + void RenderLayersAlphaProg::execute_pixel_sampled(float output[4], float x, float y, @@ -326,6 +328,7 @@ void RenderLayersAlphaProg::update_memory_buffer_partial(MemoryBuffer *output, } /* ******** Render Layers Depth Operation ******** */ + void RenderLayersDepthProg::execute_pixel_sampled(float output[4], float x, float y, diff --git a/source/blender/compositor/operations/COM_SMAAOperation.cc b/source/blender/compositor/operations/COM_SMAAOperation.cc index ef67b6ca5f9..20e85c69ac8 100644 --- a/source/blender/compositor/operations/COM_SMAAOperation.cc +++ b/source/blender/compositor/operations/COM_SMAAOperation.cc @@ -664,9 +664,6 @@ void SMAABlendingWeightCalculationOperation::get_area_of_interest(const int UNUS /*-----------------------------------------------------------------------------*/ /* Diagonal Search Functions */ -/** - * These functions allows to perform diagonal pattern searches. - */ int SMAABlendingWeightCalculationOperation::search_diag1(int x, int y, int dir, bool *found) { float e[4]; @@ -714,9 +711,6 @@ int SMAABlendingWeightCalculationOperation::search_diag2(int x, int y, int dir, return x - dir; } -/** - * This searches for diagonal patterns and returns the corresponding weights. - */ void SMAABlendingWeightCalculationOperation::calculate_diag_weights(int x, int y, const float edges[2], diff --git a/source/blender/compositor/operations/COM_SMAAOperation.h b/source/blender/compositor/operations/COM_SMAAOperation.h index 65a88d43fdf..ec04594e0aa 100644 --- a/source/blender/compositor/operations/COM_SMAAOperation.h +++ b/source/blender/compositor/operations/COM_SMAAOperation.h @@ -111,8 +111,14 @@ class SMAABlendingWeightCalculationOperation : public MultiThreadedOperation { private: /* Diagonal Search Functions */ + /** + * These functions allows to perform diagonal pattern searches. + */ int search_diag1(int x, int y, int dir, bool *found); int search_diag2(int x, int y, int dir, bool *found); + /** + * This searches for diagonal patterns and returns the corresponding weights. + */ void calculate_diag_weights(int x, int y, const float edges[2], float weights[2]); bool is_vertical_search_unneeded(int x, int y); diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cc b/source/blender/compositor/operations/COM_ScaleOperation.cc index 5a351055241..281087bb4c7 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.cc +++ b/source/blender/compositor/operations/COM_ScaleOperation.cc @@ -374,7 +374,6 @@ bool ScaleAbsoluteOperation::determine_depending_area_of_interest( return ScaleOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } -/* Absolute fixed size. */ ScaleFixedSizeOperation::ScaleFixedSizeOperation() : BaseScaleOperation() { this->add_input_socket(DataType::Color, ResizeMode::None); diff --git a/source/blender/compositor/operations/COM_ScaleOperation.h b/source/blender/compositor/operations/COM_ScaleOperation.h index 7710aa34c54..cac865b41aa 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.h +++ b/source/blender/compositor/operations/COM_ScaleOperation.h @@ -173,6 +173,7 @@ class ScaleFixedSizeOperation : public BaseScaleOperation { bool is_offset_; public: + /** Absolute fixed size. */ ScaleFixedSizeOperation(); bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, diff --git a/source/blender/compositor/operations/COM_TransformOperation.cc b/source/blender/compositor/operations/COM_TransformOperation.cc index 5b8cd35cb26..f18e7e44094 100644 --- a/source/blender/compositor/operations/COM_TransformOperation.cc +++ b/source/blender/compositor/operations/COM_TransformOperation.cc @@ -171,7 +171,6 @@ void TransformOperation::determine_canvas(const rcti &preferred_area, rcti &r_ar } } -/** Translate -> Rotate -> Scale. */ void TransformOperation::transform(BuffersIterator<float> &it, const MemoryBuffer *input_img) { float rotate_center_x, rotate_center_y; @@ -198,7 +197,6 @@ void TransformOperation::transform(BuffersIterator<float> &it, const MemoryBuffe } } -/** Scale -> Rotate -> Translate. */ void TransformOperation::transform_inverted(BuffersIterator<float> &it, const MemoryBuffer *input_img) { diff --git a/source/blender/compositor/operations/COM_TransformOperation.h b/source/blender/compositor/operations/COM_TransformOperation.h index 5c646b215f2..4db2145cc2d 100644 --- a/source/blender/compositor/operations/COM_TransformOperation.h +++ b/source/blender/compositor/operations/COM_TransformOperation.h @@ -82,7 +82,9 @@ class TransformOperation : public MultiThreadedOperation { void determine_canvas(const rcti &preferred_area, rcti &r_area) override; private: + /** Translate -> Rotate -> Scale. */ void transform(BuffersIterator<float> &it, const MemoryBuffer *input_img); + /** Scale -> Rotate -> Translate. */ void transform_inverted(BuffersIterator<float> &it, const MemoryBuffer *input_img); }; diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cc b/source/blender/compositor/operations/COM_VectorBlurOperation.cc index b220990db76..e34b629f457 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cc @@ -40,6 +40,7 @@ void zbuf_free_span(ZSpan *zspan); void antialias_tagbuf(int xsize, int ysize, char *rectmove); /* VectorBlurOperation */ + VectorBlurOperation::VectorBlurOperation() { this->add_input_socket(DataType::Color); |