18 #ifdef USE_WIN32_THREADING
79 printf(
"Thread TERMINATED\n");
100 #ifdef SINGLE_THREADED
115 spuStatus.
m_userPtr = (
void*)uiArgument0;
120 #endif //CollisionTask_LocalStoreMemory
149 #ifndef SINGLE_THREADED
152 last = res - WAIT_OBJECT_0;
168 #endif //SINGLE_THREADED
190 #ifndef SINGLE_THREADED
193 if ((res != STATUS_TIMEOUT) && (res != WAIT_FAILED))
197 last = res - WAIT_OBJECT_0;
213 #endif //SINGLE_THREADED
237 printf(
"starting thread %d\n",i);
241 LPSECURITY_ATTRIBUTES lpThreadAttributes=NULL;
243 LPTHREAD_START_ROUTINE lpStartAddress=&
Thread_no_1;
244 LPVOID lpParameter=&spuStatus;
245 DWORD dwCreationFlags=0;
246 LPDWORD lpThreadId=0;
258 HANDLE handle = CreateThread(lpThreadAttributes,dwStackSize,lpStartAddress,lpParameter, dwCreationFlags,lpThreadId);
259 SetThreadPriority(handle,THREAD_PRIORITY_HIGHEST);
262 SetThreadAffinityMask(handle, 1<<i);
271 printf(
"started thread %d with threadHandle %p\n",i,handle);
329 mRunEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
456 #endif //USE_WIN32_THREADING
void setSharedParam(int i, unsigned int p)
virtual void startSPU()
start the spus (can be called at the beginning of each frame, to make sure that the right SPU program...
virtual btCriticalSection * createCriticalSection()
void * m_eventStartHandle
Win32ThreadFunc m_userThreadFunc
unsigned int mCommonBuff[32]
const char * m_uniqueName
virtual bool isTaskCompleted(unsigned int *puiArgument0, unsigned int *puiArgument1, int timeOutInMilliseconds)
check for messages from SPUs
DWORD WINAPI Thread_no_1(LPVOID lpParam)
void * m_eventCompletetHandle
void startThreads(const Win32ThreadConstructionInfo &threadInfo)
Win32ThreadSupport(const Win32ThreadConstructionInfo &threadConstructionInfo)
The number of threads should be equal to the number of available cores.
virtual void stopSPU()
tell the task scheduler we are done with the SPU tasks
virtual void deleteBarrier(btBarrier *barrier)
CRITICAL_SECTION mExternalCriticalSection
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0), to reduce performance overhead of run-time memory (de)allocations.
int size() const
return the number of elements in the array
placeholder, until libspe2 support is there
virtual ~btWin32Barrier()
#define btAlignedFree(ptr)
CRITICAL_SECTION mCriticalSection
virtual ~btCriticalSection()
Setup and initialize SPU/CELL/Libspe2.
unsigned int getSharedParam(int i)
Win32ThreadFunc m_userThreadFunc
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1)
check for messages from SPUs
btAlignedObjectArray< btSpuStatus > m_activeSpuStatus
virtual ~Win32ThreadSupport()
cleanup/shutdown Libspe2
virtual int getMaxCount()
virtual btBarrier * createBarrier()
void resize(int newsize, const T &fillData=T())
Win32lsMemorySetupFunc m_lsMemoryFunc
~btWin32CriticalSection()
btAlignedObjectArray< void * > m_completeHandles
#define btAlignedAlloc(size, alignment)
char m_eventStartHandleName[32]
char m_eventCompletetHandleName[32]
CRITICAL_SECTION mLocalCriticalSection
virtual void setMaxCount(int n)
static void barrier(unsigned int a)
virtual void sendRequest(uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t uiArgument1)
send messages to SPUs
virtual int getNumTasks() const
#define CMD_GATHER_AND_PROCESS_PAIRLIST
virtual void deleteCriticalSection(btCriticalSection *criticalSection)