Classes | Public Member Functions | Private Attributes

Win32ThreadSupport Class Reference

Win32ThreadSupport helps to initialize/shutdown libspe2, start/stop SPU tasks and communication. More...

#include <Win32ThreadSupport.h>

Inheritance diagram for Win32ThreadSupport:
Inheritance graph
[legend]
Collaboration diagram for Win32ThreadSupport:
Collaboration graph
[legend]

List of all members.

Classes

struct  btSpuStatus
 placeholder, until libspe2 support is there More...
struct  Win32ThreadConstructionInfo
 Setup and initialize SPU/CELL/Libspe2. More...

Public Member Functions

 Win32ThreadSupport (const Win32ThreadConstructionInfo &threadConstructionInfo)
 The number of threads should be equal to the number of available cores.
virtual ~Win32ThreadSupport ()
 cleanup/shutdown Libspe2
void startThreads (const Win32ThreadConstructionInfo &threadInfo)
virtual void sendRequest (uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t uiArgument1)
 send messages to SPUs
virtual void waitForResponse (unsigned int *puiArgument0, unsigned int *puiArgument1)
 check for messages from SPUs
virtual bool isTaskCompleted (unsigned int *puiArgument0, unsigned int *puiArgument1, int timeOutInMilliseconds)
 check for messages from SPUs
virtual void startSPU ()
 start the spus (can be called at the beginning of each frame, to make sure that the right SPU program is loaded)
virtual void stopSPU ()
 tell the task scheduler we are done with the SPU tasks
virtual void setNumTasks (int numTasks)
 tell the task scheduler to use no more than numTasks tasks
virtual int getNumTasks () const
virtual void * getThreadLocalMemory (int taskId)
virtual btBarriercreateBarrier ()
virtual btCriticalSectioncreateCriticalSection ()
virtual void deleteBarrier (btBarrier *barrier)
virtual void deleteCriticalSection (btCriticalSection *criticalSection)

Private Attributes

btAlignedObjectArray< btSpuStatusm_activeSpuStatus
btAlignedObjectArray< void * > m_completeHandles
int m_maxNumTasks

Detailed Description

Win32ThreadSupport helps to initialize/shutdown libspe2, start/stop SPU tasks and communication.

Definition at line 34 of file Win32ThreadSupport.h.


Constructor & Destructor Documentation

Win32ThreadSupport::Win32ThreadSupport ( const Win32ThreadConstructionInfo threadConstructionInfo  ) 

The number of threads should be equal to the number of available cores.

Win32ThreadSupport helps to initialize/shutdown libspe2, start/stop SPU tasks and communication Setup and initialize SPU/CELL/Libspe2

Definition at line 33 of file Win32ThreadSupport.cpp.

Win32ThreadSupport::~Win32ThreadSupport (  )  [virtual]

cleanup/shutdown Libspe2

Definition at line 40 of file Win32ThreadSupport.cpp.


Member Function Documentation

btBarrier * Win32ThreadSupport::createBarrier (  )  [virtual]

Implements btThreadSupportInterface.

Definition at line 428 of file Win32ThreadSupport.cpp.

btCriticalSection * Win32ThreadSupport::createCriticalSection (  )  [virtual]

Implements btThreadSupportInterface.

Definition at line 436 of file Win32ThreadSupport.cpp.

void Win32ThreadSupport::deleteBarrier ( btBarrier barrier  )  [virtual]

Implements btThreadSupportInterface.

Definition at line 443 of file Win32ThreadSupport.cpp.

void Win32ThreadSupport::deleteCriticalSection ( btCriticalSection criticalSection  )  [virtual]

Implements btThreadSupportInterface.

Definition at line 449 of file Win32ThreadSupport.cpp.

virtual int Win32ThreadSupport::getNumTasks (  )  const [inline, virtual]

Implements btThreadSupportInterface.

Definition at line 121 of file Win32ThreadSupport.h.

virtual void* Win32ThreadSupport::getThreadLocalMemory ( int  taskId  )  [inline, virtual]

Reimplemented from btThreadSupportInterface.

Definition at line 126 of file Win32ThreadSupport.h.

bool Win32ThreadSupport::isTaskCompleted ( unsigned int *  puiArgument0,
unsigned int *  puiArgument1,
int  timeOutInMilliseconds 
) [virtual]

check for messages from SPUs

We should wait for (one of) the first tasks to finish (or other SPU messages), and report its response

A possible response can be 'yes, SPU handled it', or 'no, please do a PPU fallback'

need to find an active spu

Definition at line 180 of file Win32ThreadSupport.cpp.

void Win32ThreadSupport::sendRequest ( uint32_t  uiCommand,
ppu_address_t  uiArgument0,
uint32_t  uiArgument1 
) [virtual]

send messages to SPUs

gMidphaseSPU.sendRequest(CMD_GATHER_AND_PROCESS_PAIRLIST, (ppu_address_t) &taskDesc);

we should spawn an SPU task here, and in 'waitForResponse' it should wait for response of the (one of) the first tasks that finished

fire event to start new task

not implemented

Implements btThreadSupportInterface.

Definition at line 85 of file Win32ThreadSupport.cpp.

virtual void Win32ThreadSupport::setNumTasks ( int  numTasks  )  [inline, virtual]

tell the task scheduler to use no more than numTasks tasks

Implements btThreadSupportInterface.

Definition at line 116 of file Win32ThreadSupport.h.

void Win32ThreadSupport::startSPU (  )  [virtual]

start the spus (can be called at the beginning of each frame, to make sure that the right SPU program is loaded)

Implements btThreadSupportInterface.

Definition at line 277 of file Win32ThreadSupport.cpp.

void Win32ThreadSupport::startThreads ( const Win32ThreadConstructionInfo threadInfo  ) 

Definition at line 227 of file Win32ThreadSupport.cpp.

void Win32ThreadSupport::stopSPU (  )  [virtual]

tell the task scheduler we are done with the SPU tasks

Implements btThreadSupportInterface.

Definition at line 283 of file Win32ThreadSupport.cpp.

void Win32ThreadSupport::waitForResponse ( unsigned int *  puiArgument0,
unsigned int *  puiArgument1 
) [virtual]

check for messages from SPUs

We should wait for (one of) the first tasks to finish (or other SPU messages), and report its response

A possible response can be 'yes, SPU handled it', or 'no, please do a PPU fallback'

need to find an active spu

Implements btThreadSupportInterface.

Definition at line 139 of file Win32ThreadSupport.cpp.


Member Data Documentation

Definition at line 60 of file Win32ThreadSupport.h.

Definition at line 61 of file Win32ThreadSupport.h.

Definition at line 63 of file Win32ThreadSupport.h.


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