MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / extend

Function extend

physx/source/common/src/CmPool.h:232–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230 }
231
232 bool extend()
233 {
234 if(mSlabCount == mMaxSlabs)
235 return false;
236 T * mAddr = reinterpret_cast<T*>(Alloc::allocate(mEltsPerSlab * sizeof(T), __FILE__, __LINE__));
237 if(!mAddr)
238 return false;
239 mSlabs[mSlabCount++] = mAddr;
240
241
242
243 // Make sure the usage bitmap is up-to-size
244 if(mUseBitmap.size() < mSlabCount*mEltsPerSlab)
245 {
246 mUseBitmap.resize(2*mSlabCount*mEltsPerSlab); //set last element as not used
247 if(mFreeList)
248 PX_FREE(mFreeList);
249 mFreeList = reinterpret_cast<T**>(Alloc::allocate(2*mSlabCount * mEltsPerSlab * sizeof(T*), __FILE__, __LINE__));
250 }
251
252 // Add to free list in descending order so that lowest indices get allocated first -
253 // the FW context code currently *relies* on this behavior to grab the zero-index volume
254 // which can't be allocated to the user. TODO: fix this
255
256 PxU32 baseIndex = (mSlabCount-1) * mEltsPerSlab;
257 PxU32 freeCount = mFreeCount;
258 for(PxI32 i=PxI32(mEltsPerSlab-1);i>=0;i--)
259 mFreeList[freeCount++] = new(mAddr+i) T(mArgument, baseIndex+ i);
260
261 mFreeCount = freeCount;
262
263 return true;
264 }
265
266 PX_INLINE PxU32 getMaxUsedIndex() const
267 {

Callers 5

getFunction · 0.85
growAndSetMethod · 0.85
growAndResetMethod · 0.85
resizeFunction · 0.85
combine1Method · 0.85

Calls 3

allocateFunction · 0.85
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected