libER 0.1.4.2
ELDEN RING API library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
from::CS::CSEzTask Class Referenceabstract

Inherit from this minimal task interface to create a custom task. More...

#include <task.hpp>

Inheritance diagram for from::CS::CSEzTask:
from::FD4::FD4TaskBase from::FD4::FD4ComponentBase from::GXBS::GXDrawTask

Public Member Functions

void execute (FD4::FD4TaskData *data) final
 FD4::FD4TaskBase execute method that calls eztask_execute.
 
virtual void eztask_execute (FD4::FD4TaskData *data)=0
 Virtual method that is called when a CS::CSEzTask is executed.
 
virtual LIBERAPI void register_task (CSTaskGroup task_group)
 Register a task to be called in a specified task group.
 
virtual LIBERAPI void free_task ()
 Free the task, suspending its execution after it has been registered.
 
LIBERAPI CSTaskGroup get_task_group () const noexcept
 Get the task group this task is currently registered at.
 
- Public Member Functions inherited from from::FD4::FD4ComponentBase
virtual LIBERAPI DLRF::DLRuntimeClassget_runtime_class () noexcept
 Get the runtime class object.
 

Detailed Description

Inherit from this minimal task interface to create a custom task.

Used by ELDEN RING to queue and free asynchronous tasks in the task queue. Once a task is registered, it runs every frame when the task group specified to the register_task call is executed. The task group execution order is strict with regard to other task groups, but individual task execution order inside a task group is unspecified.

Warning
Disclaimer: a task instance must not go out of scope as long as it is registered and executing. Use from::unique_ptr from from_unique_ptr.hpp to correctly manage its lifetime. Destroying it before it has executed on this pass will leave a dangling pointer in the task queue.

Member Function Documentation

◆ execute()

void from::CS::CSEzTask::execute ( FD4::FD4TaskData data)
inlinefinalvirtual

FD4::FD4TaskBase execute method that calls eztask_execute.

Inside the ELDEN RING task system, the FD4::FD4TaskBase interface is used for executing tasks. This method delegates the execution to eztask_execute.

Parameters
dataa struct with additional data passed to the task

Implements from::FD4::FD4TaskBase.

◆ eztask_execute()

virtual void from::CS::CSEzTask::eztask_execute ( FD4::FD4TaskData data)
pure virtual

Virtual method that is called when a CS::CSEzTask is executed.

Implement this method in a custom task class to provide a callback for when the task is executed.

Parameters
dataa struct with additional data passed to the task, like delta time and the task group

◆ free_task()

virtual LIBERAPI void from::CS::CSEzTask::free_task ( )
virtual

Free the task, suspending its execution after it has been registered.

Call this method to stop executing a task. It may still execute on the current pass of the task groups, but will not execute on the next. Keep the task lifetime disclaimer in mind when freeing or destroying a task.

◆ get_task_group()

LIBERAPI CSTaskGroup from::CS::CSEzTask::get_task_group ( ) const
noexcept

Get the task group this task is currently registered at.

Returns
a value from the CS::CSTaskGroup enum

◆ register_task()

virtual LIBERAPI void from::CS::CSEzTask::register_task ( CSTaskGroup  task_group)
virtual

Register a task to be called in a specified task group.

Call this method with a task instance to register it for execution. ELDEN RING task runners execute task groups in a strict order, going from FrameBegin to FrameEnd. After a task is registered, it will be executed in the next pass of all the task groups the following frame, calling its eztask_execute method.

Parameters
task_groupa value from the CS::CSTaskGroup enum when the task should be executed

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