Beatmup
|
Custom pipeline: a sequence of tasks to be executed as a whole. More...
#include <custom_pipeline.h>
Classes | |
class | Impl |
class | PipelineNotReady |
class | TaskHolder |
A task within a pipeline. More... | |
Public Member Functions | |
~CustomPipeline () | |
int | getTaskCount () const |
TaskHolder & | getTask (int) const |
Retrieves a task by its index. More... | |
int | getTaskIndex (const TaskHolder &) |
Retrieves task index if it is in the pipeline; returns -1 otherwise. More... | |
TaskHolder & | addTask (AbstractTask &) |
Adds a new task to the end of the pipeline. More... | |
TaskHolder & | insertTask (AbstractTask &task, const TaskHolder &before) |
Inserts a task in a specified position of the pipeline before another task. More... | |
bool | removeTask (const TaskHolder &task) |
Removes a task from the pipeline. More... | |
void | measure () |
Determines pipeline execution mode and required thread count. More... | |
Public Member Functions inherited from Beatmup::Object | |
virtual | ~Object () |
Protected Member Functions | |
TaskDeviceRequirement | getUsedDevices () const |
Communicates devices (CPU and/or GPU) the task is run on. More... | |
ThreadIndex | getMaxThreads () const |
Gives the upper limint on the number of threads the task may be performed by. More... | |
void | beforeProcessing (ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu) |
Instruction called before the task is executed. More... | |
void | afterProcessing (ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted) |
Instruction called after the task is executed. More... | |
bool | process (TaskThread &thread) |
Executes the task on CPU within a given thread. More... | |
bool | processOnGPU (GraphicPipeline &gpu, TaskThread &thread) |
Executes the task on GPU. More... | |
virtual TaskHolder * | createTaskHolder (AbstractTask &task)=0 |
virtual bool | route (TaskRouter &router)=0 |
CustomPipeline () | |
Private Attributes | |
Impl * | impl |
Additional Inherited Members | |
Public Types inherited from Beatmup::AbstractTask | |
enum class | TaskDeviceRequirement { CPU_ONLY , GPU_OR_CPU , GPU_ONLY } |
Specifies which device (CPU and/or GPU) is used to run the task. More... | |
Static Public Member Functions inherited from Beatmup::AbstractTask | |
static ThreadIndex | validThreadCount (int number) |
Valid thread count from a given integer value. More... | |
Custom pipeline: a sequence of tasks to be executed as a whole.
Acts as an AbstractTask. Built by adding tasks one by one and calling measure() at the end.
Definition at line 32 of file custom_pipeline.h.
|
protected |
Definition at line 243 of file custom_pipeline.cpp.
CustomPipeline::~CustomPipeline | ( | ) |
Definition at line 247 of file custom_pipeline.cpp.
|
protectedvirtual |
Communicates devices (CPU and/or GPU) the task is run on.
Reimplemented from Beatmup::AbstractTask.
Definition at line 219 of file custom_pipeline.cpp.
|
protectedvirtual |
Gives the upper limint on the number of threads the task may be performed by.
The actual number of threads running a specific task may be less or equal to the returned value, depending on the number of workers in ThreadPool running the task.
Reimplemented from Beatmup::AbstractTask.
Definition at line 223 of file custom_pipeline.cpp.
|
protectedvirtual |
Instruction called before the task is executed.
threadCount | Number of threads used to perform the task |
target | Device used to perform the task |
gpu | A graphic pipeline instance; may be null. |
Reimplemented from Beatmup::AbstractTask.
Definition at line 227 of file custom_pipeline.cpp.
|
protectedvirtual |
Instruction called after the task is executed.
threadCount | Number of threads used to perform the task |
gpu | GPU to be used to execute the task; may be null. |
aborted | true if the task was aborted |
Reimplemented from Beatmup::AbstractTask.
Definition at line 231 of file custom_pipeline.cpp.
|
protectedvirtual |
Executes the task on CPU within a given thread.
Generally called by multiple threads.
thread | associated task execution context |
true
if the execution is finished correctly, false
otherwise Implements Beatmup::AbstractTask.
Definition at line 235 of file custom_pipeline.cpp.
|
protectedvirtual |
Executes the task on GPU.
gpu | graphic pipeline instance |
thread | associated task execution context |
true
if the execution is finished correctly, false
otherwise Reimplemented from Beatmup::AbstractTask.
Definition at line 239 of file custom_pipeline.cpp.
|
protectedpure virtual |
Implemented in Beatmup::Multitask.
|
protectedpure virtual |
Implemented in Beatmup::Multitask.
int CustomPipeline::getTaskCount | ( | ) | const |
CustomPipeline::TaskHolder & CustomPipeline::getTask | ( | int | index | ) | const |
Retrieves a task by its index.
Definition at line 255 of file custom_pipeline.cpp.
int CustomPipeline::getTaskIndex | ( | const TaskHolder & | task | ) |
Retrieves task index if it is in the pipeline; returns -1 otherwise.
Definition at line 259 of file custom_pipeline.cpp.
CustomPipeline::TaskHolder & CustomPipeline::addTask | ( | AbstractTask & | task | ) |
Adds a new task to the end of the pipeline.
Definition at line 263 of file custom_pipeline.cpp.
CustomPipeline::TaskHolder & CustomPipeline::insertTask | ( | AbstractTask & | task, |
const TaskHolder & | before | ||
) |
Inserts a task in a specified position of the pipeline before another task.
task | The task to insert |
before | TaskHolder specifying position of the task that will follow the newly inserted task |
Definition at line 269 of file custom_pipeline.cpp.
bool CustomPipeline::removeTask | ( | const TaskHolder & | task | ) |
Removes a task from the pipeline.
task | The task to remove |
true
on success, false
if this TaskHolder is not in the pipeline. Definition at line 275 of file custom_pipeline.cpp.
void CustomPipeline::measure | ( | ) |
Determines pipeline execution mode and required thread count.
Definition at line 279 of file custom_pipeline.cpp.
|
private |
Definition at line 37 of file custom_pipeline.h.