16#ifdef WITH_CXX_GUARDEDALLOC
26 const char *view_name,
57 delete execution_model_;
67 operations_ = operations;
76 execution_model_->
execute(*
this);
83 std::function<
void(
const rcti &split_rect)> work_func)
91 const int num_sub_works = std::min(num_work_threads_, work_height);
92 const int split_height = num_sub_works == 0 ? 0 : work_height / num_sub_works;
93 int remaining_height = work_height - split_height * num_sub_works;
96 int sub_work_y = work_rect.
ymin;
97 int num_sub_works_finished = 0;
98 for (
int i = 0; i < num_sub_works; i++) {
99 int sub_work_height = split_height;
102 if (remaining_height > 0) {
108 sub_work.
execute_fn = [=, &work_func, &work_rect]() {
114 &split_rect, work_rect.
xmin, work_rect.
xmax, sub_work_y, sub_work_y + sub_work_height);
115 work_func(split_rect);
119 num_sub_works_finished++;
120 if (num_sub_works_finished == num_sub_works) {
126 sub_work_y += sub_work_height;
136 if (num_sub_works_finished < num_sub_works) {
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
void BLI_mutex_end(ThreadMutex *mutex)
void BLI_condition_wait(ThreadCondition *cond, ThreadMutex *mutex)
void BLI_mutex_init(ThreadMutex *mutex)
void BLI_condition_end(ThreadCondition *cond)
void BLI_condition_notify_one(ThreadCondition *cond)
void BLI_condition_init(ThreadCondition *cond)
void BLI_mutex_lock(ThreadMutex *mutex)
void BLI_mutex_unlock(ThreadMutex *mutex)
Read Guarded memory(de)allocation.
void set_bnodetree(bNodeTree *bnodetree)
set the bnodetree of the context
void set_scene(Scene *scene)
const bNodeTree * get_bnodetree() const
get the bnodetree of the context
realtime_compositor::Profiler * get_profiler() const
get the profiler
void set_render_context(realtime_compositor::RenderContext *render_context)
set the render context
void set_view_name(const char *view_name)
set the active rendering view
void set_profiler(realtime_compositor::Profiler *profiler)
set the profiler
void set_preview_hash(bke::bNodeInstanceHash *previews)
set the preview image hash table
void set_render_data(RenderData *rd)
set the scene of the context
void set_rendering(bool rendering)
set the rendering field of the context
static void execute_started()
virtual void execute(ExecutionSystem &exec_system)=0
void set_operations(Span< NodeOperation * > operations)
void execute()
execute this system
ExecutionSystem(RenderData *rd, Scene *scene, bNodeTree *editingtree, bool rendering, const char *view_name, realtime_compositor::RenderContext *render_context, realtime_compositor::Profiler *profiler)
Create a new ExecutionSystem and initialize it with the editingtree.
void execute_work(const rcti &work_rect, std::function< void(const rcti &split_rect)> work_func)
void convert_to_operations(ExecutionSystem *system)
NodeOperation contains calculation logic.
void finalize(const bNodeTree &node_tree)
bNodeTreeRuntimeHandle * runtime
NodeInstanceHashHandle * previews
contains data about work that can be scheduled
std::function< void()> executed_fn
std::function< void()> execute_fn
static int get_num_cpu_threads()
static void schedule(WorkPackage *package)
schedule a chunk of a group to be calculated. An execution group schedules a chunk in the WorkSchedul...
static void finish()
wait for all work to be completed.