Defined in include/task/PxTask.h

Inheritance Relationships

Base Type

class PxLightCpuTask : public PxBaseTask

A PxBaseTask implementation with immediate execution and simple dependencies.

A PxLightCpuTask bypasses the PxTaskManager launch dependencies and will be submitted directly to your scene’s CpuDispatcher. When the run() function completes, it will decrement the reference count of the specified continuation task.

You must use a full-blown PxTask if you want your task to be resolved by another PxTask, or you need more than a single dependency to be resolved when your task completes, or your task will not run on the CpuDispatcher.

Public Functions

inline PxLightCpuTask()
inline virtual ~PxLightCpuTask()
inline void setContinuation(PxTaskManager &tm, PxBaseTask *c)

Initialize this task and specify the task that will have its ref count decremented on completion.

Submission is deferred until the task’s mRefCount is decremented to zero.

Note that we only use the

PxTaskManager to query the appropriate dispatcher.

  • tm[in] The PxTaskManager this task is managed by

  • c[in] The task to be executed when this task has finished running

inline void setContinuation(PxBaseTask *c)

Initialize this task and specify the task that will have its ref count decremented on completion.

This overload of setContinuation() queries the PxTaskManager from the continuation task, which cannot be NULL.


c[in] The task to be executed after this task has finished running

inline PxBaseTask *getContinuation() const

Retrieves continuation task.

inline virtual void removeReference() override

Manually decrement this task’s reference count.

If the reference count reaches zero, the task will be dispatched.

inline virtual int32_t getReference() const override

Return the ref-count for this task.

inline virtual void addReference() override

Manually increment this task’s reference count.

The task will not be allowed to run until removeReference() is called.

inline virtual void release() override

called by CpuDispatcher after run method has completed

Decrements the continuation task’s reference count, if specified.

virtual void run() = 0

The user-implemented run method where the task’s work should be performed.

run() methods must be thread safe, stack friendly (no alloca, etc), and must never block.

virtual const char *getName() const = 0

Return a user-provided task name for profiling purposes.

It does not have to be unique, but unique names are helpful.


The name of this task

inline PxTaskManager *getTaskManager() const

Return PxTaskManager to which this task was submitted.

Note, can return NULL if task was not submitted, or has been completed.

inline void setContextId(PxU64 id)
inline PxU64 getContextId() const

Protected Attributes

PxBaseTask *mCont

Continuation task, can be NULL.

int32_t mRefCount

PxTask is dispatched when reaches 0.

PxU64 mContextID

Context ID for profiler interface.

PxTaskManager *mTm

Owning PxTaskManager instance.


friend class PxTaskMgr