Cleanup: improve naming in Compositor
This commit is contained in:
@@ -5,22 +5,22 @@ namespace blender::compositor {
|
||||
|
||||
MultiThreadedOperation::MultiThreadedOperation()
|
||||
{
|
||||
m_num_passes = 1;
|
||||
num_passes_ = 1;
|
||||
current_pass_ = 0;
|
||||
flags.is_fullframe_operation = true;
|
||||
}
|
||||
|
||||
void MultiThreadedOperation::update_memory_buffer(MemoryBuffer *output,
|
||||
const rcti &output_area,
|
||||
blender::Span<MemoryBuffer *> inputs,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs,
|
||||
ExecutionSystem &exec_system)
|
||||
{
|
||||
for (current_pass_ = 0; current_pass_ < m_num_passes; current_pass_++) {
|
||||
update_memory_buffer_started(output, output_area, inputs, exec_system);
|
||||
exec_system.execute_work(output_area, [=, &exec_system](const rcti &split_rect) {
|
||||
for (current_pass_ = 0; current_pass_ < num_passes_; current_pass_++) {
|
||||
update_memory_buffer_started(output, area, inputs, exec_system);
|
||||
exec_system.execute_work(area, [=, &exec_system](const rcti &split_rect) {
|
||||
update_memory_buffer_partial(output, split_rect, inputs, exec_system);
|
||||
});
|
||||
update_memory_buffer_finished(output, output_area, inputs, exec_system);
|
||||
update_memory_buffer_finished(output, area, inputs, exec_system);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class MultiThreadedOperation : public NodeOperation {
|
||||
/**
|
||||
* Number of execution passes.
|
||||
*/
|
||||
int m_num_passes;
|
||||
int num_passes_;
|
||||
/**
|
||||
* Current execution pass.
|
||||
*/
|
||||
@@ -40,34 +40,34 @@ class MultiThreadedOperation : public NodeOperation {
|
||||
* Called before an update memory buffer pass is executed. Single-threaded calls.
|
||||
*/
|
||||
virtual void update_memory_buffer_started(MemoryBuffer *UNUSED(output),
|
||||
const rcti &UNUSED(output_rect),
|
||||
blender::Span<MemoryBuffer *> UNUSED(inputs),
|
||||
const rcti &UNUSED(area),
|
||||
Span<MemoryBuffer *> UNUSED(inputs),
|
||||
ExecutionSystem &UNUSED(exec_system))
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes operation updating output memory buffer on output_rect area. Multi-threaded calls.
|
||||
* Executes operation updating a memory buffer area. Multi-threaded calls.
|
||||
*/
|
||||
virtual void update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &output_rect,
|
||||
blender::Span<MemoryBuffer *> inputs,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs,
|
||||
ExecutionSystem &exec_system) = 0;
|
||||
|
||||
/**
|
||||
* Called after an update memory buffer pass is executed. Single-threaded calls.
|
||||
*/
|
||||
virtual void update_memory_buffer_finished(MemoryBuffer *UNUSED(output),
|
||||
const rcti &UNUSED(output_rect),
|
||||
blender::Span<MemoryBuffer *> UNUSED(inputs),
|
||||
const rcti &UNUSED(area),
|
||||
Span<MemoryBuffer *> UNUSED(inputs),
|
||||
ExecutionSystem &UNUSED(exec_system))
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
void update_memory_buffer(MemoryBuffer *output,
|
||||
const rcti &output_area,
|
||||
blender::Span<MemoryBuffer *> inputs,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs,
|
||||
ExecutionSystem &exec_system) override;
|
||||
};
|
||||
|
||||
|
@@ -188,12 +188,12 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input,
|
||||
* caller must clamp it.
|
||||
* TODO: See if it's possible to use parameter overloading (input_id for example).
|
||||
*
|
||||
* \param input_op_idx: Input operation index for which we want to calculate the area being read.
|
||||
* \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_op_idx,
|
||||
void NodeOperation::get_area_of_interest(const int input_idx,
|
||||
const rcti &output_area,
|
||||
rcti &r_input_area)
|
||||
{
|
||||
@@ -203,7 +203,7 @@ void NodeOperation::get_area_of_interest(const int input_op_idx,
|
||||
else {
|
||||
/* Non full-frame operations never implement this method. To ensure correctness assume
|
||||
* whole area is used. */
|
||||
NodeOperation *input_op = getInputOperation(input_op_idx);
|
||||
NodeOperation *input_op = getInputOperation(input_idx);
|
||||
BLI_rcti_init(&r_input_area, 0, input_op->getWidth(), 0, input_op->getHeight());
|
||||
}
|
||||
}
|
||||
|
@@ -578,7 +578,7 @@ class NodeOperation {
|
||||
* Executes operation updating output memory buffer. Single-threaded calls.
|
||||
*/
|
||||
virtual void update_memory_buffer(MemoryBuffer *UNUSED(output),
|
||||
const rcti &UNUSED(output_area),
|
||||
const rcti &UNUSED(area),
|
||||
Span<MemoryBuffer *> UNUSED(inputs),
|
||||
ExecutionSystem &UNUSED(exec_system))
|
||||
{
|
||||
@@ -587,7 +587,7 @@ class NodeOperation {
|
||||
/**
|
||||
* Get input operation area being read by this operation on rendering given output area.
|
||||
*/
|
||||
virtual void get_area_of_interest(int input_op_idx, const rcti &output_area, rcti &r_input_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);
|
||||
|
||||
/** \} */
|
||||
|
@@ -43,12 +43,12 @@ void SetColorOperation::determineResolution(unsigned int resolution[2],
|
||||
}
|
||||
|
||||
void SetColorOperation::update_memory_buffer(MemoryBuffer *output,
|
||||
const rcti &output_area,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> UNUSED(inputs),
|
||||
ExecutionSystem &UNUSED(exec_system))
|
||||
{
|
||||
BLI_assert(output->is_a_single_elem());
|
||||
float *out_elem = output->get_elem(output_area.xmin, output_area.ymin);
|
||||
float *out_elem = output->get_elem(area.xmin, area.ymin);
|
||||
copy_v4_v4(out_elem, m_color);
|
||||
}
|
||||
|
||||
|
@@ -82,7 +82,7 @@ class SetColorOperation : public NodeOperation {
|
||||
unsigned int preferredResolution[2]) override;
|
||||
|
||||
void update_memory_buffer(MemoryBuffer *output,
|
||||
const rcti &output_area,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs,
|
||||
ExecutionSystem &exec_system) override;
|
||||
};
|
||||
|
@@ -43,12 +43,12 @@ void SetValueOperation::determineResolution(unsigned int resolution[2],
|
||||
}
|
||||
|
||||
void SetValueOperation::update_memory_buffer(MemoryBuffer *output,
|
||||
const rcti &output_area,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> UNUSED(inputs),
|
||||
ExecutionSystem &UNUSED(exec_system))
|
||||
{
|
||||
BLI_assert(output->is_a_single_elem());
|
||||
float *out_elem = output->get_elem(output_area.xmin, output_area.ymin);
|
||||
float *out_elem = output->get_elem(area.xmin, area.ymin);
|
||||
*out_elem = m_value;
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,7 @@ class SetValueOperation : public NodeOperation {
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void update_memory_buffer(MemoryBuffer *output,
|
||||
const rcti &output_area,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs,
|
||||
ExecutionSystem &exec_system) override;
|
||||
};
|
||||
|
Reference in New Issue
Block a user