Blender  V2.93
COM_WorkScheduler.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2011, Blender Foundation.
17  */
18 
19 #pragma once
20 
21 #include "COM_ExecutionGroup.h"
22 
23 #include "COM_Device.h"
24 #include "COM_WorkPackage.h"
25 #include "COM_defines.h"
26 
27 namespace blender::compositor {
28 
32 struct WorkScheduler {
40  static void schedule(WorkPackage *package);
41 
54  static void initialize(bool use_opencl, int num_cpu_threads);
55 
60  static void deinitialize();
61 
68  static void start(CompositorContext &context);
69 
75  static void stop();
76 
80  static void finish();
81 
88  static bool has_gpu_devices();
89 
90  static int current_thread_id();
91 
92 #ifdef WITH_CXX_GUARDEDALLOC
93  MEM_CXX_CLASS_ALLOC_FUNCS("COM:WorkScheduler")
94 #endif
95 };
96 
97 } // namespace blender::compositor
Overall context of the compositor.
contains data about work that can be scheduled
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 deinitialize()
deinitialize the WorkScheduler free all allocated resources
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.
static void stop()
stop the execution All created thread by the start method are destroyed.
static void start(CompositorContext &context)
Start the execution this methods will start the WorkScheduler. Inside this method all threads are ini...
static void initialize(bool use_opencl, int num_cpu_threads)
initialize the WorkScheduler