diff options
| author | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-09-15 15:41:57 -0500 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-09-15 15:41:57 -0500 |
| commit | d1c812f1162e5fdb13c215792725b2591d7428f5 (patch) | |
| tree | 407056c45c7e9320c48fca6a3697d81a061c4ea0 /PhysX_3.4/Source/PhysXCharacterKinematic/src | |
| parent | PhysX 3.4, APEX 1.4 patch release @22121272 (diff) | |
| download | physx-3.4-d1c812f1162e5fdb13c215792725b2591d7428f5.tar.xz physx-3.4-d1c812f1162e5fdb13c215792725b2591d7428f5.zip | |
PhysX 3.4.1, APEX 1.4.1 Release @22845541v3.4.1
Diffstat (limited to 'PhysX_3.4/Source/PhysXCharacterKinematic/src')
| -rw-r--r-- | PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.h b/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.h index 3d515e16..b0411c34 100644 --- a/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.h +++ b/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.h @@ -88,14 +88,25 @@ namespace Cct // PT: customized version of "reserveContainerMemory" const PxU32 maxNbEntries = Ps::Array<PxTriangle>::capacity(); - // PT: allocate one more tri to make sure we can safely V4Load the last one... const PxU32 realRequiredSize = Ps::Array<PxTriangle>::size() + nbTris; + // PT: allocate one more tri to make sure we can safely V4Load the last one... const PxU32 requiredSize = realRequiredSize + 1; if(requiredSize>maxNbEntries) { - const PxU32 naturalGrowthSize = maxNbEntries ? maxNbEntries*2 : 2; - const PxU32 newSize = PxMax(requiredSize, naturalGrowthSize); + // PT: ok so the commented out growing policy was introduced by PX-837 but it produces + // large memory usage regressions (see PX-881) while not actually making things run + // faster. Our benchmarks show no performance difference, but up to +38% more memory + // used with this "standard" growing policy. So for now we just go back to the initial + // growing policy. It should be fine since PX-837 was not actually reported by a customer, + // it was just a concern that appeared while looking at the code. Ideally we'd use a pool + // with fixed-size slabs to get the best of both worlds but it would make iterating over + // triangles more complicated and would need more refactoring. So for now we don't bother, + // but we'll keep this note here for the next time this problem shows up. +// const PxU32 naturalGrowthSize = maxNbEntries ? maxNbEntries*2 : 2; +// const PxU32 newSize = PxMax(requiredSize, naturalGrowthSize); + const PxU32 newSize = requiredSize; + Ps::Array<PxTriangle>::reserve(newSize); } |