15 #ifdef WITH_CXX_GUARDEDALLOC
26 const char *view_name)
73 delete execution_model_;
89 operations_ = operations;
99 execution_model_->
execute(*
this);
103 std::function<
void(
const rcti &split_rect)> work_func)
111 const int num_sub_works =
MIN2(num_work_threads_, work_height);
112 const int split_height = num_sub_works == 0 ? 0 : work_height / num_sub_works;
113 int remaining_height = work_height - split_height * num_sub_works;
116 int sub_work_y = work_rect.
ymin;
117 int num_sub_works_finished = 0;
118 for (
int i = 0; i < num_sub_works; i++) {
119 int sub_work_height = split_height;
122 if (remaining_height > 0) {
129 sub_work.
execute_fn = [=, &work_func, &work_rect]() {
135 &split_rect, work_rect.
xmin, work_rect.
xmax, sub_work_y, sub_work_y + sub_work_height);
136 work_func(split_rect);
140 num_sub_works_finished++;
141 if (num_sub_works_finished == num_sub_works) {
147 sub_work_y += sub_work_height;
157 if (num_sub_works_finished < num_sub_works) {
#define BLI_assert_msg(a, msg)
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_quality(eCompositorQuality quality)
set the quality
void set_bnodetree(bNodeTree *bnodetree)
set the bnodetree of the context
void set_scene(Scene *scene)
void set_preview_hash(bNodeInstanceHash *previews)
set the preview image hash table
void set_view_name(const char *view_name)
set the active rendering view
eExecutionModel get_execution_model() const
void setHasActiveOpenCLDevices(bool hasAvtiveOpenCLDevices)
set has this system active opencl_devices?
void set_render_data(RenderData *rd)
set the scene of the context
void set_fast_calculation(bool fast_calculation)
const bNodeTree * get_bnodetree() const
get the bnodetree of the context
void set_rendering(bool rendering)
set the rendering field of the context
static void execute_started(const ExecutionSystem *system)
Class ExecutionGroup is a group of Operations that are executed as one. This grouping is used to comb...
virtual void execute(ExecutionSystem &exec_system)=0
void execute()
execute this system
void set_operations(const Vector< NodeOperation * > &operations, const Vector< ExecutionGroup * > &groups)
ExecutionSystem(RenderData *rd, Scene *scene, bNodeTree *editingtree, bool rendering, bool fastcalculation, const char *view_name)
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.
eCompositorQuality
Possible quality settings.
@ CustomFunction
Executes a custom function.
int(* test_break)(void *)
struct bNodeInstanceHash * 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 bool has_gpu_devices()
Are there OpenCL capable GPU devices initialized? the result of this method is stored in the Composit...
static void finish()
wait for all work to be completed.