MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator / reserve

Method reserve

include/vk_mem_alloc.h:4801–4821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4799
4800template<typename T, typename AllocatorT>
4801void VmaVector<T, AllocatorT>::reserve(size_t newCapacity, bool freeMemory)
4802{
4803 newCapacity = VMA_MAX(newCapacity, m_Count);
4804
4805 if ((newCapacity < m_Capacity) && !freeMemory)
4806 {
4807 newCapacity = m_Capacity;
4808 }
4809
4810 if (newCapacity != m_Capacity)
4811 {
4812 T* const newArray = newCapacity ? VmaAllocateArray<T>(m_Allocator, newCapacity) : VMA_NULL;
4813 if (m_Count != 0)
4814 {
4815 memcpy(newArray, m_pArray, m_Count * sizeof(T));
4816 }
4817 VmaFree(m_Allocator.m_pCallbacks, m_pArray);
4818 m_Capacity = newCapacity;
4819 m_pArray = newArray;
4820 }
4821}
4822
4823template<typename T, typename AllocatorT>
4824void VmaVector<T, AllocatorT>::resize(size_t newCount)

Calls 1

VmaFreeFunction · 0.85