Beatmup
Beatmup::TextureHandleFactory Class Reference

Task generating a valid OpenGL texture handle. More...

Inheritance diagram for Beatmup::TextureHandleFactory:
Beatmup::AbstractTask Beatmup::Object

Static Public Member Functions

static Beatmup::GL::handle_t makeHandle (Context &ctx)
 
- 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

 TextureHandleFactory (Context &ctx)
 
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...
 

Private Attributes

Contextctx
 
Beatmup::GL::handle_t textureHandle
 

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

Task generating a valid OpenGL texture handle.

Used to produce handles for external textures.

Definition at line 33 of file external_bitmap.cpp.

Constructor & Destructor Documentation

◆ TextureHandleFactory()

Beatmup::TextureHandleFactory::TextureHandleFactory ( Context ctx)
inlineprivate

Definition at line 38 of file external_bitmap.cpp.

38  :
39  ctx(ctx)
40  {}

Member Function Documentation

◆ processOnGPU()

bool Beatmup::TextureHandleFactory::processOnGPU ( GraphicPipeline gpu,
TaskThread thread 
)
inlineprivatevirtual

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 42 of file external_bitmap.cpp.

42  {
43  glGenTextures(1, &textureHandle);
44  return true;
45  }
Beatmup::GL::handle_t textureHandle

◆ process()

bool Beatmup::TextureHandleFactory::process ( TaskThread thread)
inlineprivatevirtual

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 47 of file external_bitmap.cpp.

47  {
48  return false;
49  }

◆ getUsedDevices()

TaskDeviceRequirement Beatmup::TextureHandleFactory::getUsedDevices ( ) const
inlineprivatevirtual

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

Reimplemented from Beatmup::AbstractTask.

Definition at line 51 of file external_bitmap.cpp.

51  {
53  }
@ GPU_ONLY
this task requires GPU, otherwise it cannot run

◆ makeHandle()

static Beatmup::GL::handle_t Beatmup::TextureHandleFactory::makeHandle ( Context ctx)
inlinestatic

Definition at line 56 of file external_bitmap.cpp.

56  {
58  ctx.performTask(me);
59  return me.textureHandle;
60  }
float performTask(AbstractTask &task, const PoolIndex pool=DEFAULT_POOL)
Performs a given task.
Definition: context.cpp:240
Task generating a valid OpenGL texture handle.

Member Data Documentation

◆ ctx

Context& Beatmup::TextureHandleFactory::ctx
private

Definition at line 35 of file external_bitmap.cpp.

◆ textureHandle

Beatmup::GL::handle_t Beatmup::TextureHandleFactory::textureHandle
private

Definition at line 36 of file external_bitmap.cpp.


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