Files
test2/source/blender/compositor/intern/COM_MultiThreadedOperation.cc
Manuel Castilla 9adfd278f7 Compositor: Full-frame base system
This patch adds the base code needed to make the full-frame system work for both current tiled/per-pixel implementation of operations and full-frame.

Two execution models:
- Tiled: Current implementation. Renders execution groups in tiles from outputs to input. Not all operations are buffered. Runs the tiled/per-pixel implementation.
- FullFrame: All operations are buffered. Fully renders operations from inputs to outputs. Runs full-frame implementation of operations if available otherwise the current tiled/per-pixel. Creates output buffers on first read and free them as soon as all its readers have finished, reducing peak memory usage of complex/long trees. Operations are multi-threaded but do not run in parallel as Tiled (will be done in another patch).

This should allow us to convert operations to full-frame in small steps with the system already working and solve the problem of high memory usage.

FullFrame breaking changes respect Tiled system, mainly:
- Translate, Rotate, Scale, and Transform take effect immediately instead of next buffered operation.
- Any sampling is always done over inputs instead of last buffered operation.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11113
2021-06-01 10:51:53 +02:00

27 lines
1022 B
C++

#include "COM_MultiThreadedOperation.h"
#include "COM_ExecutionSystem.h"
namespace blender::compositor {
MultiThreadedOperation::MultiThreadedOperation()
{
m_num_passes = 1;
flags.is_fullframe_operation = true;
}
void MultiThreadedOperation::update_memory_buffer(MemoryBuffer *output,
const rcti &output_area,
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);
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_finished(output, output_area, inputs, exec_system, current_pass);
}
}
} // namespace blender::compositor