21 #include <condition_variable>
Task: an operation that can be executed by multiple threads in parallel.
static ThreadIndex validThreadCount(int number)
Valid thread count from a given integer value.
TaskDeviceRequirement
Specifies which device (CPU and/or GPU) is used to run the task.
@ GPU_OR_CPU
this task uses GPU if it is available, but CPU fallback is possible
@ CPU_ONLY
this task does not use GPU
@ GPU_ONLY
this task requires GPU, otherwise it cannot run
virtual TaskDeviceRequirement getUsedDevices() const
Communicates devices (CPU and/or GPU) the task is run on.
virtual void beforeProcessing(ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu)
Instruction called before the task is executed.
virtual bool processOnGPU(GraphicPipeline &gpu, TaskThread &thread)
Executes the task on GPU.
virtual ThreadIndex getMaxThreads() const
Gives the upper limint on the number of threads the task may be performed by.
virtual void afterProcessing(ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted)
Instruction called after the task is executed.
virtual bool process(TaskThread &thread)=0
Executes the task on CPU within a given thread.
Internal low-level GPU control API.
Beatmup object base class
ThreadIndex index
current thread index
virtual ThreadIndex numThreads() const =0
TaskThread(const TaskThread &)=delete
virtual void synchronize()=0
Blocks until all the other threads running the same task reach the same point.
ThreadIndex currentThread() const
virtual bool isTaskAborted() const =0
Returns true if the task is asked to stop from outside.
TaskThread(ThreadIndex index)
unsigned char ThreadIndex
number of threads / thread index
static const ThreadIndex MAX_THREAD_INDEX
maximum possible thread index value
unsigned char PoolIndex
number of tread pools or a pool index