aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/LowLevel
diff options
context:
space:
mode:
Diffstat (limited to 'PhysX_3.4/Source/LowLevel')
-rw-r--r--PhysX_3.4/Source/LowLevel/common/src/pipeline/PxcNpBatch.cpp13
-rw-r--r--PhysX_3.4/Source/LowLevel/software/src/PxsIslandSim.cpp39
2 files changed, 45 insertions, 7 deletions
diff --git a/PhysX_3.4/Source/LowLevel/common/src/pipeline/PxcNpBatch.cpp b/PhysX_3.4/Source/LowLevel/common/src/pipeline/PxcNpBatch.cpp
index 3b2d98c1..1700a765 100644
--- a/PhysX_3.4/Source/LowLevel/common/src/pipeline/PxcNpBatch.cpp
+++ b/PhysX_3.4/Source/LowLevel/common/src/pipeline/PxcNpBatch.cpp
@@ -91,8 +91,11 @@ static bool copyBuffers(PxsContactManagerOutput& cmOutput, Gu::Cache& cache, Pxc
ret = true;
PxU8* oldPatches = cmOutput.contactPatches;
PxU8* oldContacts = cmOutput.contactPoints;
+ PxReal* oldForces = cmOutput.contactForces;
PxU32 forceSize = cmOutput.nbContacts * sizeof(PxReal);
+ if(isMeshType)
+ forceSize += cmOutput.nbContacts * sizeof(PxU32);
PxU8* PX_RESTRICT contactPatches = NULL;
PxU8* PX_RESTRICT contactPoints = NULL;
@@ -127,8 +130,6 @@ static bool copyBuffers(PxsContactManagerOutput& cmOutput, Gu::Cache& cache, Pxc
if(forceSize)
{
- forceSize = isMeshType ? (forceSize * 2) : forceSize;
-
index = PxU32(Ps::atomicAdd(&context.mForceAndIndiceStreamPool->mSharedDataIndex, PxI32(forceSize)));
if(context.mForceAndIndiceStreamPool->isOverflown())
@@ -150,6 +151,10 @@ static bool copyBuffers(PxsContactManagerOutput& cmOutput, Gu::Cache& cache, Pxc
{
PxMemCopy(contactPatches, oldPatches, patchSize);
PxMemCopy(contactPoints, oldContacts, contactSize);
+ if (isMeshType)
+ {
+ PxMemCopy(forceBuffer + cmOutput.nbContacts, oldForces + cmOutput.nbContacts, sizeof(PxU32) * cmOutput.nbContacts);
+ }
}
}
else
@@ -164,6 +169,10 @@ static bool copyBuffers(PxsContactManagerOutput& cmOutput, Gu::Cache& cache, Pxc
contactPoints = data + cmOutput.nbPatches * sizeof(PxContactPatch);
PxMemCopy(data, oldPatches, oldSize);
+ if (isMeshType)
+ {
+ PxMemCopy(forceBuffer + cmOutput.nbContacts, oldForces + cmOutput.nbContacts, sizeof(PxU32) * cmOutput.nbContacts);
+ }
}
if(forceSize)
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);
}