Cleanup: move public doc-strings into headers for 'compositor'
Ref T92709
This commit is contained in:
parent
7c76bdca1b
commit
8aed5dbcf8
Notes:
blender-bot
2023-02-13 17:15:14 +01:00
Referenced by issue #93854, Relocate doc-strings into public headers Referenced by issue #92709, Code Style: documentation at declaration or definition
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
/**
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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, "");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -39,6 +39,7 @@ class InpaintSimpleOperation : public NodeOperation {
|
|||
short *manhattan_distance_;
|
||||
|
||||
public:
|
||||
/** In-paint (simple convolve using average of known pixels). */
|
||||
InpaintSimpleOperation();
|
||||
|
||||
/**
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue