Cleanup: move function parameter to member

Get current pass only when needed.
This commit is contained in:
Manuel Castilla 2021-06-21 13:09:40 +02:00
parent 2851602052
commit 4246898ad3
2 changed files with 12 additions and 10 deletions

View File

@ -6,6 +6,7 @@ namespace blender::compositor {
MultiThreadedOperation::MultiThreadedOperation()
{
m_num_passes = 1;
current_pass_ = 0;
flags.is_fullframe_operation = true;
}
@ -14,12 +15,12 @@ void MultiThreadedOperation::update_memory_buffer(MemoryBuffer *output,
blender::Span<MemoryBuffer *> inputs,
ExecutionSystem &exec_system)
{
for (int current_pass = 0; current_pass < m_num_passes; current_pass++) {
update_memory_buffer_started(output, output_area, inputs, exec_system, current_pass);
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) {
update_memory_buffer_partial(output, split_rect, inputs, exec_system, current_pass);
update_memory_buffer_partial(output, split_rect, inputs, exec_system);
});
update_memory_buffer_finished(output, output_area, inputs, exec_system, current_pass);
update_memory_buffer_finished(output, output_area, inputs, exec_system);
}
}

View File

@ -28,6 +28,10 @@ class MultiThreadedOperation : public NodeOperation {
* Number of execution passes.
*/
int m_num_passes;
/**
* Current execution pass.
*/
int current_pass_;
protected:
MultiThreadedOperation();
@ -38,8 +42,7 @@ class MultiThreadedOperation : public NodeOperation {
virtual void update_memory_buffer_started(MemoryBuffer *UNUSED(output),
const rcti &UNUSED(output_rect),
blender::Span<MemoryBuffer *> UNUSED(inputs),
ExecutionSystem &UNUSED(exec_system),
int UNUSED(current_pass))
ExecutionSystem &UNUSED(exec_system))
{
}
@ -49,8 +52,7 @@ class MultiThreadedOperation : public NodeOperation {
virtual void update_memory_buffer_partial(MemoryBuffer *output,
const rcti &output_rect,
blender::Span<MemoryBuffer *> inputs,
ExecutionSystem &exec_system,
int current_pass) = 0;
ExecutionSystem &exec_system) = 0;
/**
* Called after an update memory buffer pass is executed. Single-threaded calls.
@ -58,8 +60,7 @@ class MultiThreadedOperation : public NodeOperation {
virtual void update_memory_buffer_finished(MemoryBuffer *UNUSED(output),
const rcti &UNUSED(output_rect),
blender::Span<MemoryBuffer *> UNUSED(inputs),
ExecutionSystem &UNUSED(exec_system),
int UNUSED(current_pass))
ExecutionSystem &UNUSED(exec_system))
{
}