* Called by the owner (Scene) to start simulating the task graph. * Dispatch all tasks with refCount == 1 */
| 217 | * Dispatch all tasks with refCount == 1 |
| 218 | */ |
| 219 | void PxTaskMgr::startSimulation() |
| 220 | { |
| 221 | PX_ASSERT( mCpuDispatcher ); |
| 222 | |
| 223 | if( mGpuDispatcher ) |
| 224 | { |
| 225 | mGpuDispatcher->startSimulation(); |
| 226 | } |
| 227 | |
| 228 | /* Handle empty task graph */ |
| 229 | if( mPendingTasks == 0 ) |
| 230 | { |
| 231 | |
| 232 | return; |
| 233 | } |
| 234 | |
| 235 | bool gpuDispatch = false; |
| 236 | for( PxTaskID i = 0 ; i < mTaskTable.size() ; i++ ) |
| 237 | { |
| 238 | if( mTaskTable[ i ].mType == PxTaskType::TT_COMPLETED ) |
| 239 | { |
| 240 | continue; |
| 241 | } |
| 242 | if( !shdfnd::atomicDecrement( &mTaskTable[ i ].mRefCount ) ) |
| 243 | { |
| 244 | mStartDispatch.pushBack(i); |
| 245 | } |
| 246 | } |
| 247 | for( uint32_t i=0; i<mStartDispatch.size(); ++i) |
| 248 | { |
| 249 | gpuDispatch |= dispatchTask( mStartDispatch[i], gpuDispatch ); |
| 250 | } |
| 251 | //mStartDispatch.resize(0); |
| 252 | mStartDispatch.forceSize_Unsafe(0); |
| 253 | |
| 254 | if( mGpuDispatcher && gpuDispatch ) |
| 255 | { |
| 256 | mGpuDispatcher->finishGroup(); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | void PxTaskMgr::stopSimulation() |
| 261 | { |
no test coverage detected