MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / reserve

Method reserve

modules/engine/graphics/src/d3d12/D3D12MemAlloc.cpp:1043–1063  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1041
1042template<typename T>
1043void Vector<T>::reserve(size_t newCapacity, bool freeMemory)
1044{
1045 newCapacity = D3D12MA_MAX(newCapacity, m_Count);
1046
1047 if ((newCapacity < m_Capacity) && !freeMemory)
1048 {
1049 newCapacity = m_Capacity;
1050 }
1051
1052 if (newCapacity != m_Capacity)
1053 {
1054 T* const newArray = newCapacity ? AllocateArray<T>(m_AllocationCallbacks, newCapacity) : NULL;
1055 if (m_Count != 0)
1056 {
1057 memcpy(newArray, m_pArray, m_Count * sizeof(T));
1058 }
1059 Free(m_AllocationCallbacks, m_pArray);
1060 m_Capacity = newCapacity;
1061 m_pArray = newArray;
1062 }
1063}
1064
1065template<typename T>
1066void Vector<T>::resize(size_t newCount, bool freeMemory)

Callers 1

Calls 3

D3D12MA_MAXFunction · 0.85
memcpyFunction · 0.85
FreeFunction · 0.85

Tested by

no test coverage detected