mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-22 15:04:34 +00:00
Removed VMA_USE_STL_CONTAINERS
This commit is contained in:
parent
cbad11e039
commit
7c48285034
@ -15,7 +15,6 @@ message(STATUS "VMA_BUILD_SAMPLE_SHADERS = ${VMA_BUILD_SAMPLE_SHADERS}")
|
||||
message(STATUS "VMA_BUILD_REPLAY = ${VMA_BUILD_REPLAY}")
|
||||
|
||||
option(VMA_RECORDING_ENABLED "Enable VMA memory recording for debugging" OFF)
|
||||
option(VMA_USE_STL_CONTAINERS "Use C++ STL containers instead of VMA's containers" OFF)
|
||||
option(VMA_STATIC_VULKAN_FUNCTIONS "Link statically with Vulkan API" ON)
|
||||
option(VMA_DYNAMIC_VULKAN_FUNCTIONS "Fetch pointers to Vulkan functions internally (no static linking)" OFF)
|
||||
option(VMA_DEBUG_ALWAYS_DEDICATED_MEMORY "Every allocation will have its own memory block" OFF)
|
||||
@ -24,7 +23,6 @@ option(VMA_DEBUG_GLOBAL_MUTEX "Enable single mutex protecting all entry calls to
|
||||
option(VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT "Never exceed VkPhysicalDeviceLimits::maxMemoryAllocationCount and return error" OFF)
|
||||
|
||||
message(STATUS "VMA_RECORDING_ENABLED = ${VMA_RECORDING_ENABLED}")
|
||||
message(STATUS "VMA_USE_STL_CONTAINERS = ${VMA_USE_STL_CONTAINERS}")
|
||||
message(STATUS "VMA_STATIC_VULKAN_FUNCTIONS = ${VMA_STATIC_VULKAN_FUNCTIONS}")
|
||||
message(STATUS "VMA_DYNAMIC_VULKAN_FUNCTIONS = ${VMA_DYNAMIC_VULKAN_FUNCTIONS}")
|
||||
message(STATUS "VMA_DEBUG_ALWAYS_DEDICATED_MEMORY = ${VMA_DEBUG_ALWAYS_DEDICATED_MEMORY}")
|
||||
|
@ -65,7 +65,7 @@ Additional features:
|
||||
|
||||
# Prequisites
|
||||
|
||||
- Self-contained C++ library in single header file. No external dependencies other than standard C and C++ library and of course Vulkan. Some features of C++14 used. STL containers are not used by default.
|
||||
- Self-contained C++ library in single header file. No external dependencies other than standard C and C++ library and of course Vulkan. Some features of C++14 used. STL containers are not used.
|
||||
- Public interface in C, in same convention as Vulkan API. Implementation in C++.
|
||||
- Error handling implemented by returning `VkResult` error codes - same way as in Vulkan.
|
||||
- Interface documented using Doxygen-style comments.
|
||||
|
@ -2508,21 +2508,6 @@ VmaAllocatorCreateInfo::pVulkanFunctions. Other members can be null.
|
||||
#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1
|
||||
#endif
|
||||
|
||||
// Define this macro to 1 to make the library use STL containers instead of its own implementation.
|
||||
//#define VMA_USE_STL_CONTAINERS 1
|
||||
|
||||
/* Set this macro to 1 to make the library including and using STL containers:
|
||||
std::pair, std::vector, std::list, std::unordered_map.
|
||||
|
||||
Set it to 0 or undefined to make the library using its own implementation of
|
||||
the containers.
|
||||
*/
|
||||
#if VMA_USE_STL_CONTAINERS
|
||||
#define VMA_USE_STL_VECTOR 1
|
||||
#define VMA_USE_STL_UNORDERED_MAP 1
|
||||
#define VMA_USE_STL_LIST 1
|
||||
#endif
|
||||
|
||||
#ifndef VMA_USE_STL_SHARED_MUTEX
|
||||
// Compiler conforms to C++17.
|
||||
#if __cplusplus >= 201703L
|
||||
@ -2536,22 +2521,6 @@ the containers.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
THESE INCLUDES ARE NOT ENABLED BY DEFAULT.
|
||||
Library has its own container implementation.
|
||||
*/
|
||||
#if VMA_USE_STL_VECTOR
|
||||
#include <vector>
|
||||
#endif
|
||||
|
||||
#if VMA_USE_STL_UNORDERED_MAP
|
||||
#include <unordered_map>
|
||||
#endif
|
||||
|
||||
#if VMA_USE_STL_LIST
|
||||
#include <list>
|
||||
#endif
|
||||
|
||||
/*
|
||||
Following headers are used in this CONFIGURATION section only, so feel free to
|
||||
remove them if not needed.
|
||||
@ -2971,12 +2940,8 @@ struct AtomicTransactionalIncrement;
|
||||
template<typename T>
|
||||
struct VmaStlAllocator;
|
||||
|
||||
#if VMA_USE_STL_VECTOR
|
||||
#define VmaVector std::vector
|
||||
#else
|
||||
template<typename T, typename AllocatorT>
|
||||
class VmaVector;
|
||||
#endif // VMA_USE_STL_VECTOR
|
||||
|
||||
template<typename T, typename AllocatorT, size_t N>
|
||||
class VmaSmallVector;
|
||||
@ -2984,9 +2949,6 @@ class VmaSmallVector;
|
||||
template<typename T>
|
||||
class VmaPoolAllocator;
|
||||
|
||||
#if VMA_USE_STL_LIST
|
||||
#define VmaList std::list
|
||||
#else
|
||||
template<typename T>
|
||||
struct VmaListItem;
|
||||
|
||||
@ -2995,11 +2957,21 @@ class VmaRawList;
|
||||
|
||||
template<typename T, typename AllocatorT>
|
||||
class VmaList;
|
||||
#endif // VMA_USE_STL_LIST
|
||||
|
||||
template<typename ItemTypeTraits>
|
||||
class VmaIntrusiveLinkedList;
|
||||
|
||||
// Unused in this version
|
||||
#if 0
|
||||
template<typename T1, typename T2>
|
||||
struct VmaPair;
|
||||
template<typename FirstT, typename SecondT>
|
||||
struct VmaPairFirstLess;
|
||||
|
||||
template<typename KeyT, typename ValueT>
|
||||
class VmaMap;
|
||||
#endif
|
||||
|
||||
#if VMA_STATS_STRING_ENABLED
|
||||
class VmaStringBuilder;
|
||||
class VmaJsonWriter;
|
||||
@ -3693,21 +3665,7 @@ struct VmaStlAllocator
|
||||
};
|
||||
#endif // _VMA_STL_ALLOCATOR
|
||||
|
||||
#if VMA_USE_STL_VECTOR
|
||||
|
||||
template<typename T, typename allocatorT>
|
||||
static void VmaVectorInsert(std::vector<T, allocatorT>& vec, size_t index, const T& item)
|
||||
{
|
||||
vec.insert(vec.begin() + index, item);
|
||||
}
|
||||
|
||||
template<typename T, typename allocatorT>
|
||||
static void VmaVectorRemove(std::vector<T, allocatorT>& vec, size_t index)
|
||||
{
|
||||
vec.erase(vec.begin() + index);
|
||||
}
|
||||
|
||||
#else
|
||||
#ifndef _VMA_VECTOR
|
||||
/* Class with interface compatible with subset of std::vector.
|
||||
T must be POD because constructors and destructors are not called and memcpy is
|
||||
used for these objects. */
|
||||
@ -3918,8 +3876,7 @@ static void VmaVectorRemove(VmaVector<T, allocatorT>& vec, size_t index)
|
||||
{
|
||||
vec.remove(index);
|
||||
}
|
||||
|
||||
#endif // VMA_USE_STL_VECTOR
|
||||
#endif // _VMA_VECTOR
|
||||
|
||||
#ifndef _VMA_SMALL_VECTOR
|
||||
/*
|
||||
@ -4205,7 +4162,6 @@ typename VmaPoolAllocator<T>::ItemBlock& VmaPoolAllocator<T>::CreateNewBlock()
|
||||
#endif // _VMA_POOL_ALLOCATOR_FUNCTIONS
|
||||
#endif // _VMA_POOL_ALLOCATOR
|
||||
|
||||
#ifndef VMA_USE_STL_LIST
|
||||
#ifndef _VMA_RAW_LIST
|
||||
template<typename T>
|
||||
struct VmaListItem
|
||||
@ -4686,7 +4642,6 @@ typename VmaList<T, AllocatorT>::const_reverse_iterator& VmaList<T, AllocatorT>:
|
||||
}
|
||||
#endif // _VMA_LIST_FUNCTIONS
|
||||
#endif // _VMA_LIST
|
||||
#endif // VMA_USE_STL_LIST
|
||||
|
||||
#ifndef _VMA_INTRUSIVE_LINKED_LIST
|
||||
/*
|
||||
@ -4939,15 +4894,7 @@ void VmaIntrusiveLinkedList<ItemTypeTraits>::RemoveAll()
|
||||
// Unused in this version.
|
||||
#if 0
|
||||
|
||||
#if VMA_USE_STL_UNORDERED_MAP
|
||||
|
||||
#define VmaPair std::pair
|
||||
|
||||
#define VMA_MAP_TYPE(KeyT, ValueT) \
|
||||
std::unordered_map< KeyT, ValueT, std::hash<KeyT>, std::equal_to<KeyT>, VmaStlAllocator< std::pair<KeyT, ValueT> > >
|
||||
|
||||
#else // #if VMA_USE_STL_UNORDERED_MAP
|
||||
|
||||
#ifndef _VMA_PAIR
|
||||
template<typename T1, typename T2>
|
||||
struct VmaPair
|
||||
{
|
||||
@ -4958,6 +4905,21 @@ struct VmaPair
|
||||
VmaPair(const T1& firstSrc, const T2& secondSrc) : first(firstSrc), second(secondSrc) {}
|
||||
};
|
||||
|
||||
template<typename FirstT, typename SecondT>
|
||||
struct VmaPairFirstLess
|
||||
{
|
||||
bool operator()(const VmaPair<FirstT, SecondT>& lhs, const VmaPair<FirstT, SecondT>& rhs) const
|
||||
{
|
||||
return lhs.first < rhs.first;
|
||||
}
|
||||
bool operator()(const VmaPair<FirstT, SecondT>& lhs, const FirstT& rhsFirst) const
|
||||
{
|
||||
return lhs.first < rhsFirst;
|
||||
}
|
||||
};
|
||||
#endif // _VMA_PAIR
|
||||
|
||||
#ifndef _VMA_MAP
|
||||
/* Class compatible with subset of interface of std::unordered_map.
|
||||
KeyT, ValueT must be POD because they will be stored in VmaVector.
|
||||
*/
|
||||
@ -4981,21 +4943,7 @@ private:
|
||||
VmaVector< PairType, VmaStlAllocator<PairType> > m_Vector;
|
||||
};
|
||||
|
||||
#define VMA_MAP_TYPE(KeyT, ValueT) VmaMap<KeyT, ValueT>
|
||||
|
||||
template<typename FirstT, typename SecondT>
|
||||
struct VmaPairFirstLess
|
||||
{
|
||||
bool operator()(const VmaPair<FirstT, SecondT>& lhs, const VmaPair<FirstT, SecondT>& rhs) const
|
||||
{
|
||||
return lhs.first < rhs.first;
|
||||
}
|
||||
bool operator()(const VmaPair<FirstT, SecondT>& lhs, const FirstT& rhsFirst) const
|
||||
{
|
||||
return lhs.first < rhsFirst;
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef _VMA_MAP_FUNCTIONS
|
||||
template<typename KeyT, typename ValueT>
|
||||
void VmaMap<KeyT, ValueT>::insert(const PairType& pair)
|
||||
{
|
||||
@ -5030,8 +4978,8 @@ void VmaMap<KeyT, ValueT>::erase(iterator it)
|
||||
{
|
||||
VmaVectorRemove(m_Vector, it - m_Vector.begin());
|
||||
}
|
||||
|
||||
#endif // #if VMA_USE_STL_UNORDERED_MAP
|
||||
#endif // _VMA_MAP_FUNCTIONS
|
||||
#endif // _VMA_MAP
|
||||
|
||||
#endif // #if 0
|
||||
|
||||
|
@ -47,7 +47,6 @@ target_compile_definitions(
|
||||
VulkanMemoryAllocator
|
||||
|
||||
PUBLIC
|
||||
VMA_USE_STL_CONTAINERS=$<BOOL:${VMA_USE_STL_CONTAINERS}>
|
||||
VMA_STATIC_VULKAN_FUNCTIONS=$<BOOL:${VULKAN_USE_STATIC}>
|
||||
VMA_DYNAMIC_VULKAN_FUNCTIONS=$<BOOL:${VULKAN_USE_DYNAMIC}>
|
||||
VMA_DEBUG_ALWAYS_DEDICATED_MEMORY=$<BOOL:${VMA_DEBUG_ALWAYS_DEDICATED_MEMORY}>
|
||||
|
@ -31,8 +31,6 @@
|
||||
#endif // #if !defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
//#define VMA_USE_STL_CONTAINERS 1
|
||||
|
||||
//#define VMA_HEAVY_ASSERT(expr) assert(expr)
|
||||
|
||||
//#define VMA_DEDICATED_ALLOCATION 0
|
||||
|
Loading…
Reference in New Issue
Block a user