A task to be executed on one or more SPUs. More...
#include <PxSpuTask.h>
Public Member Functions | |
PxSpuTask (const void *elfStart, PxU32 elfSize, PxU32 numSpus=1, const PxU32 *args=NULL) | |
Construct a new PxSpuTask object. More... | |
virtual | ~PxSpuTask () |
PX_INLINE PxU32 | getSpuCount () const |
Return the number of SPUs used to run this task. More... | |
PX_INLINE void | setSpuCount (PxU32 numSpusToRun) |
Set the number of SPUs to be used when running this task. More... | |
PX_INLINE const PxU32 * | getArgs (PxU32 spuIndex) const |
Retrieve the per-SPU argument. More... | |
PX_INLINE void | setArgs (PxU32 spuIndex, PxU32 arg0, PxU32 arg1) |
Set the arguments for a given SPU worker. More... | |
PX_INLINE const void * | getElfStart () const |
Return the address to the start of the embedded elf binary for this task. More... | |
PX_INLINE PxU32 | getElfSize () const |
Return the size of the embedded elf binary for this task. More... | |
PX_INLINE void | notifySpuFinish () |
Called by the SpuDispatcher when a SPU worker has completed, when all workers have completed the task is considered finished and the continuation will have it's ref count decremented. More... | |
virtual void | removeReference () |
Modifies PxLightCpuTask's behavior by submitting to the SpuDispatcher. More... | |
virtual void | run () |
Allow the task to perform PPU side intialization before the task is scheduled to the SPUs. More... | |
void | runProfiled () |
The same as run() but will emit PVD profile events. More... | |
Public Member Functions inherited from PxLightCpuTask | |
PxLightCpuTask () | |
virtual | ~PxLightCpuTask () |
PX_INLINE void | setContinuation (PxTaskManager &tm, PxBaseTask *c) |
Initialize this task and specify the task that will have its ref count decremented on completion. More... | |
PX_INLINE void | setContinuation (PxBaseTask *c) |
Initialize this task and specify the task that will have its ref count decremented on completion. More... | |
PX_INLINE PxBaseTask * | getContinuation () const |
Retrieves continuation task. More... | |
PX_INLINE void | removeReference () |
Manually decrement this task's reference count. If the reference count reaches zero, the task will be dispatched. More... | |
PX_INLINE PxI32 | getReference () const |
Return the ref-count for this task. More... | |
PX_INLINE void | addReference () |
Manually increment this task's reference count. The task will not be allowed to run until removeReference() is called. More... | |
PX_INLINE void | release () |
called by CpuDispatcher after run method has completed More... | |
Public Member Functions inherited from PxBaseTask | |
PxBaseTask () | |
virtual | ~PxBaseTask () |
virtual const char * | getName () const =0 |
Return a user-provided task name for profiling purposes. More... | |
PX_INLINE void | runProfiled (PxU32 threadId=0) |
Execute user run method with wrapping profiling events. More... | |
PX_INLINE void | setProfileStat (PxU16 stat) |
Specify stop event statistic. More... | |
PX_INLINE PxTaskManager * | getTaskManager () const |
Return PxTaskManager to which this task was submitted. More... | |
Static Public Attributes | |
static const PxU32 | kMaxSpus = 6 |
The maximum number of SPUs. More... | |
static const PxU32 | kArgsPerSpu = 2 |
Arguments per SPU. More... | |
Protected Attributes | |
const void * | mElfStart |
A pointer to the start of the ELF image. More... | |
PxU32 | mElfSize |
The size of the ELF image. More... | |
PxU32 | mNbSpusToRun |
The number of SPUs to run. More... | |
PxU32 | mNbSpusFinished |
The number of SPUs finished. More... | |
PxU32 | mArgs [kMaxSpus][kArgsPerSpu] |
The arguments for the SPUs. More... | |
bool | mEmitProfile |
Stores the profile event state if runProfiled() is used. More... | |
Protected Attributes inherited from PxLightCpuTask | |
PxBaseTask * | mCont |
Continuation task, can be NULL. More... | |
volatile PxI32 | mRefCount |
PxTask is dispatched when reaches 0. More... | |
Protected Attributes inherited from PxBaseTask | |
PxU16 | mEventID |
Registered profile event ID. More... | |
PxU16 | mProfileStat |
Profiling statistic. More... | |
PxTaskManager * | mTm |
Owning PxTaskManager instance. More... | |
A task to be executed on one or more SPUs.
Each PxSpuTask can run in a data parallel fashion on up to 6 SPUs. To coordinate the workers, each SPU will be passed its own set of arguments.
When all SPU workers have completed their work, the task is considered complete and the SpuDispatcher will call release on the task, this in turn will call removeReference() on the task's continuation.
In this way LightCpuTasks may be launched automatically at PxSpuTask completion and vice versa.
Users should not need to implement or create SpuTasks directly. The SDK creates the tasks internally and will submit them to the TaskManager's SpuDispatcher for execution. The SpuDispatcher that will be used is configured on a per-scene basis through the PxSceneDesc.
|
inline |
Construct a new PxSpuTask object.
[in] | elfStart | The starting address of the embedded SPU binary |
[in] | elfSize | The size in bytes of the embedded SPU binary |
[in] | numSpus | The number of SPU workers this task will run across |
[in] | args | A pointer to an array of arguments, must be at least kArgsPerSpu*numSpus big |
|
inlinevirtual |
Retrieve the per-SPU argument.
[in] | spuIndex | The SPU that we want to retrieve the argument for |
References PX_ASSERT.
Return the size of the embedded elf binary for this task.
|
inline |
Return the address to the start of the embedded elf binary for this task.
Return the number of SPUs used to run this task.
|
inline |
Called by the SpuDispatcher when a SPU worker has completed, when all workers have completed the task is considered finished and the continuation will have it's ref count decremented.
|
inlinevirtual |
Modifies PxLightCpuTask's behavior by submitting to the SpuDispatcher.
Implements PxBaseTask.
References PX_ASSERT.
|
inlinevirtual |
Allow the task to perform PPU side intialization before the task is scheduled to the SPUs.
This should be called by the SpuDispatcher from whichever thread calls submitTask(); the task should be scheduled to the SPUs immediately following this function returning.
Implements PxBaseTask.
|
inline |
The same as run() but will emit PVD profile events.
Set the arguments for a given SPU worker.
[in] | spuIndex | The index of the SPU worker whose arguments are to be set |
[in] | arg0 | The first argument to be passed to this worker |
[in] | arg1 | The second argument to be passed to this worker |
References PX_ASSERT.
Set the number of SPUs to be used when running this task.
References PX_ASSERT.
|
static |
Arguments per SPU.
|
static |
The maximum number of SPUs.
|
protected |
The arguments for the SPUs.
|
protected |
The size of the ELF image.
|
protected |
A pointer to the start of the ELF image.
|
protected |
Stores the profile event state if runProfiled() is used.
|
protected |
The number of SPUs finished.
|
protected |
The number of SPUs to run.