diff options
| author | Sheikh Dawood Abdul Ajees <[email protected]> | 2018-09-25 11:33:48 -0500 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <[email protected]> | 2018-09-25 11:33:48 -0500 |
| commit | ad993f2926db6fe4ba2c75e17c4f099d9d853038 (patch) | |
| tree | 426f831e7aa870a4704b8dd082538ff292e751f9 /PhysX_3.4/Source/LowLevel/software/src/PxsIslandSim.cpp | |
| parent | PhysX 3.4, APEX 1.4 patch release @24698370 (diff) | |
| download | physx-3.4-ad993f2926db6fe4ba2c75e17c4f099d9d853038.tar.xz physx-3.4-ad993f2926db6fe4ba2c75e17c4f099d9d853038.zip | |
PhysX 3.4, APEX 1.4 patch release @24990349
Diffstat (limited to 'PhysX_3.4/Source/LowLevel/software/src/PxsIslandSim.cpp')
| -rw-r--r-- | PhysX_3.4/Source/LowLevel/software/src/PxsIslandSim.cpp | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/PhysX_3.4/Source/LowLevel/software/src/PxsIslandSim.cpp b/PhysX_3.4/Source/LowLevel/software/src/PxsIslandSim.cpp index 2108fb9f..94d570fa 100644 --- a/PhysX_3.4/Source/LowLevel/software/src/PxsIslandSim.cpp +++ b/PhysX_3.4/Source/LowLevel/software/src/PxsIslandSim.cpp @@ -1330,10 +1330,13 @@ bool IslandSim::findRoute(NodeIndex startNode, NodeIndex targetNode, IslandId is } } +#define IG_LIMIT_DIRTY_NODES 0 + void IslandSim::processLostEdges(Ps::Array<NodeIndex>& destroyedNodes, bool allowDeactivation, bool permitKinematicDeactivation, PxU32 dirtyNodeLimit) { + PX_UNUSED(dirtyNodeLimit); PX_PROFILE_ZONE("Basic.processLostEdges", getContextId()); //At this point, all nodes and edges are activated. @@ -1416,18 +1419,34 @@ void IslandSim::processLostEdges(Ps::Array<NodeIndex>& destroyedNodes, bool allo if (allowDeactivation) { PX_PROFILE_ZONE("Basic.findPathsAndBreakIslands", getContextId()); - Cm::BitMap::CircularIterator iter(mDirtyMap, mLastMapIndex); + //KS - process only this many dirty nodes, deferring future dirty nodes to subsequent frames. //This means that it may take several frames for broken edges to trigger islands to completely break but this is better //than triggering large performance spikes. - const PxU32 MaxCount = dirtyNodeLimit; - +#if IG_LIMIT_DIRTY_NODES + Cm::BitMap::CircularIterator iter(mDirtyMap, mLastMapIndex); + const PxU32 MaxCount = dirtyNodeLimit;// +10000000; + PxU32 lastMapIndex = mLastMapIndex; PxU32 count = 0; +#else + Cm::BitMap::Iterator iter(mDirtyMap); +#endif + + PxU32 dirtyIdx; - while ((dirtyIdx = iter.getNext()) != Cm::BitMap::CircularIterator::DONE && (count++ < MaxCount)) + +#if IG_LIMIT_DIRTY_NODES + while ((dirtyIdx = iter.getNext()) != Cm::BitMap::CircularIterator::DONE + && (count++ < MaxCount) +#else + while ((dirtyIdx = iter.getNext()) != Cm::BitMap::Iterator::DONE +#endif + ) { - mLastMapIndex = dirtyIdx + 1; +#if IG_LIMIT_DIRTY_NODES + lastMapIndex = dirtyIdx + 1; +#endif //Process dirty nodes. Figure out if we can make our way from the dirty node to the root. mPriorityQueue.clear(); //Clear the queue used for traversal @@ -1652,11 +1671,21 @@ void IslandSim::processLostEdges(Ps::Array<NodeIndex>& destroyedNodes, bool allo } dirtyNode.clearDirty(); +#if IG_LIMIT_DIRTY_NODES mDirtyMap.reset(dirtyIdx); +#endif } + + +#if IG_LIMIT_DIRTY_NODES + mLastMapIndex = lastMapIndex; if (count < MaxCount) mLastMapIndex = 0; +#else + mDirtyMap.clear(); +#endif + //mDirtyNodes.forceSize_Unsafe(0); } |