Beatmup
Beatmup::DisplaySwitch Class Reference

#include <display_switch.h>

Inheritance diagram for Beatmup::DisplaySwitch:
Beatmup::AbstractTask Beatmup::Object

Static Public Member Functions

static bool run (Context &ctx, void *switchingData=nullptr)
 
- Static Public Member Functions inherited from Beatmup::AbstractTask
static ThreadIndex validThreadCount (int number)
 Valid thread count from a given integer value. More...
 

Private Member Functions

bool processOnGPU (GraphicPipeline &gpu, TaskThread &)
 Executes the task on GPU. More...
 
bool process (TaskThread &thread)
 Executes the task on CPU within a given thread. More...
 
TaskDeviceRequirement getUsedDevices () const
 Communicates devices (CPU and/or GPU) the task is run on. More...
 
 DisplaySwitch ()
 

Private Attributes

void * switchingData
 
bool gpuIsOk
 

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 ThreadIndex getMaxThreads () const
 Gives the upper limint on the number of threads the task may be performed by. More...
 
- Public Member Functions inherited from Beatmup::Object
virtual ~Object ()
 

Detailed Description

Definition at line 28 of file display_switch.h.

Constructor & Destructor Documentation

◆ DisplaySwitch()

DisplaySwitch::DisplaySwitch ( )
private

Definition at line 44 of file display_switch.cpp.

44 : switchingData(nullptr), gpuIsOk(false) {}

Member Function Documentation

◆ processOnGPU()

bool DisplaySwitch::processOnGPU ( GraphicPipeline gpu,
TaskThread thread 
)
privatevirtual

Executes the task on GPU.

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

Reimplemented from Beatmup::AbstractTask.

Definition at line 24 of file display_switch.cpp.

24  {
25  gpuIsOk = true;
26 #ifdef BEATMUP_PLATFORM_ANDROID
28 #endif
29  return true;
30 }
void switchDisplay(void *data)
Definition: pipeline.cpp:871

◆ process()

bool DisplaySwitch::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.

Definition at line 33 of file display_switch.cpp.

33  {
34  gpuIsOk = false;
35  return true;
36 }

◆ getUsedDevices()

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

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

Reimplemented from Beatmup::AbstractTask.

Definition at line 39 of file display_switch.cpp.

39  {
41 }
@ GPU_OR_CPU
this task uses GPU if it is available, but CPU fallback is possible

◆ run()

bool DisplaySwitch::run ( Context ctx,
void *  switchingData = nullptr 
)
static

Definition at line 47 of file display_switch.cpp.

47  {
49  task.switchingData = switchingData;
51  return task.gpuIsOk;
52 }
float performTask(AbstractTask &task, const PoolIndex pool=DEFAULT_POOL)
Performs a given task.
Definition: context.cpp:240
Beatmup::Context * ctx
Beatmup::NNets::InferenceTask * task

Member Data Documentation

◆ switchingData

void* Beatmup::DisplaySwitch::switchingData
private

Definition at line 30 of file display_switch.h.

◆ gpuIsOk

bool Beatmup::DisplaySwitch::gpuIsOk
private

Definition at line 31 of file display_switch.h.


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