Beatmup
Beatmup::GpuTask Class Reference

Template of a task using GPU. More...

#include <gpu_task.h>

Inheritance diagram for Beatmup::GpuTask:
Beatmup::AbstractTask Beatmup::Object Beatmup::GL::StorageBufferFetcher Beatmup::NNets::InferenceTask Beatmup::SceneRenderer Beatmup::ShaderApplicator Beatmup::Swapper Beatmup::NNets::Classifier

Private 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...
 
bool process (TaskThread &thread)
 Executes the task on CPU within a given thread. More...
 

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...
 
- Public Member Functions inherited from Beatmup::AbstractTask
virtual void beforeProcessing (ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu)
 Instruction called before the task is executed. More...
 
virtual void afterProcessing (ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted)
 Instruction called after the task is executed. More...
 
virtual bool processOnGPU (GraphicPipeline &gpu, TaskThread &thread)
 Executes the task on GPU. More...
 
- Public Member Functions inherited from Beatmup::Object
virtual ~Object ()
 
- Static Public Member Functions inherited from Beatmup::AbstractTask
static ThreadIndex validThreadCount (int number)
 Valid thread count from a given integer value. More...
 

Detailed Description

Template of a task using GPU.

Definition at line 27 of file gpu_task.h.

Member Function Documentation

◆ getUsedDevices()

AbstractTask::TaskDeviceRequirement GpuTask::getUsedDevices ( ) const
privatevirtual

Communicates devices (CPU and/or GPU) the task is run on.

Reimplemented from Beatmup::AbstractTask.

Definition at line 24 of file gpu_task.cpp.

24  {
26 }
@ GPU_ONLY
this task requires GPU, otherwise it cannot run

◆ getMaxThreads()

ThreadIndex GpuTask::getMaxThreads ( ) const
privatevirtual

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.

Reimplemented in Beatmup::NNets::InferenceTask.

Definition at line 28 of file gpu_task.cpp.

28  {
29  return 1;
30 }

◆ process()

bool GpuTask::process ( TaskThread thread)
privatevirtual

Executes the task on CPU within a given thread.

Generally called by multiple threads.

Parameters
threadassociated task execution context
Returns
true if the execution is finished correctly, false otherwise

Implements Beatmup::AbstractTask.

Reimplemented in Beatmup::NNets::InferenceTask, and Beatmup::SceneRenderer.

Definition at line 32 of file gpu_task.cpp.

32  {
33  Insanity::insanity("A GPU requiring task is being run with no GPU support provided.");
34  return false;
35 }
static void insanity(const char *message)
Definition: exception.h:136

The documentation for this class was generated from the following files: