| 2182 | } |
| 2183 | |
| 2184 | void AABBManager::postBroadPhase(PxBaseTask* continuation, PxBaseTask* narrowPhaseUnlockTask, Cm::FlushPool& flushPool) |
| 2185 | { |
| 2186 | PX_PROFILE_ZONE("AABBManager::postBroadPhase", getContextId()); |
| 2187 | |
| 2188 | //KS - There is a continuation task for discrete broad phase, but not for CCD broad phase. PostBroadPhase for CCD broad phase runs in-line. |
| 2189 | //This probably should be revisited but it means that we can't use the parallel codepath within CCD. |
| 2190 | if (continuation) |
| 2191 | { |
| 2192 | mPostBroadPhase3.setContinuation(continuation); |
| 2193 | mPostBroadPhase2.setContinuation(&mPostBroadPhase3); |
| 2194 | } |
| 2195 | |
| 2196 | mTimestamp++; |
| 2197 | |
| 2198 | // PT: TODO: consider merging mCreatedOverlaps & mDestroyedOverlaps |
| 2199 | // PT: TODO: revisit memory management of mCreatedOverlaps & mDestroyedOverlaps |
| 2200 | |
| 2201 | //KS - if we ran broad phase, fetch the results now |
| 2202 | if(mAddedHandles.size() != 0 || mUpdatedHandles.size() != 0 || mRemovedHandles.size() != 0) |
| 2203 | mBroadPhase.fetchBroadPhaseResults(narrowPhaseUnlockTask); |
| 2204 | |
| 2205 | for(PxU32 i=0; i<ElementType::eCOUNT; i++) |
| 2206 | { |
| 2207 | resetOrClear(mCreatedOverlaps[i]); |
| 2208 | resetOrClear(mDestroyedOverlaps[i]); |
| 2209 | } |
| 2210 | |
| 2211 | { |
| 2212 | PX_PROFILE_ZONE("AABBManager::postBroadPhase - process deleted pairs", getContextId()); |
| 2213 | // processBPPairs<CreatedPairHandler>(mBroadPhase.getNbCreatedPairs(), mBroadPhase.getCreatedPairs(), *this); |
| 2214 | processBPPairs<DeletedPairHandler>(mBroadPhase.getNbDeletedPairs(), mBroadPhase.getDeletedPairs(), *this); |
| 2215 | } |
| 2216 | |
| 2217 | { |
| 2218 | //If there is a continuation task, then this is not part of CCD, so we can trigger bounds to be recomputed in parallel before pair generation runs during |
| 2219 | //stage 2. |
| 2220 | if (continuation) |
| 2221 | { |
| 2222 | const PxU32 size = mDirtyAggregates.size(); |
| 2223 | for (PxU32 i = 0; i < size; i += SortAggregateBoundsParallel::MaxPairs) |
| 2224 | { |
| 2225 | const PxU32 nbToProcess = PxMin(size - i, SortAggregateBoundsParallel::MaxPairs); |
| 2226 | |
| 2227 | SortAggregateBoundsParallel* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(SortAggregateBoundsParallel)), SortAggregateBoundsParallel) |
| 2228 | (mContextID, &mDirtyAggregates[i], nbToProcess); |
| 2229 | |
| 2230 | task->setContinuation(&mPostBroadPhase2); |
| 2231 | task->removeReference(); |
| 2232 | } |
| 2233 | } |
| 2234 | } |
| 2235 | |
| 2236 | |
| 2237 | |
| 2238 | if (continuation) |
| 2239 | { |
| 2240 | mPostBroadPhase2.setFlushPool(&flushPool); |
| 2241 | mPostBroadPhase3.removeReference(); |
nothing calls this directly
no test coverage detected