Removed VMA_USE_STL_CONTAINERS
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bacd8b6..d46b019 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,7 +15,6 @@
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_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}")
diff --git a/README.md b/README.md
index 5c1e81a..0f2f2a5 100644
--- a/README.md
+++ b/README.md
@@ -65,7 +65,7 @@
# 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.
diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h
index aa5dfb4..ec9b977 100644
--- a/include/vk_mem_alloc.h
+++ b/include/vk_mem_alloc.h
@@ -2508,21 +2508,6 @@
#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
@@ -2537,22 +2522,6 @@
#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 @@
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 @@
template<typename T>
class VmaPoolAllocator;
-#if VMA_USE_STL_LIST
-#define VmaList std::list
-#else
template<typename T>
struct VmaListItem;
@@ -2995,11 +2957,21 @@
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 @@
};
#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 @@
{
vec.remove(index);
}
-
-#endif // VMA_USE_STL_VECTOR
+#endif // _VMA_VECTOR
#ifndef _VMA_SMALL_VECTOR
/*
@@ -4205,7 +4162,6 @@
#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 @@
}
#endif // _VMA_LIST_FUNCTIONS
#endif // _VMA_LIST
-#endif // VMA_USE_STL_LIST
#ifndef _VMA_INTRUSIVE_LINKED_LIST
/*
@@ -4939,50 +4894,17 @@
// 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
{
T1 first;
T2 second;
- VmaPair() : first(), second() { }
- VmaPair(const T1& firstSrc, const T2& secondSrc) : first(firstSrc), second(secondSrc) { }
+ VmaPair() : first(), second() {}
+ VmaPair(const T1& firstSrc, const T2& secondSrc) : first(firstSrc), second(secondSrc) {}
};
-/* Class compatible with subset of interface of std::unordered_map.
-KeyT, ValueT must be POD because they will be stored in VmaVector.
-*/
-template<typename KeyT, typename ValueT>
-class VmaMap
-{
-public:
- typedef VmaPair<KeyT, ValueT> PairType;
- typedef PairType* iterator;
-
- VmaMap(const VmaStlAllocator<PairType>& allocator) : m_Vector(allocator) { }
-
- iterator begin() { return m_Vector.begin(); }
- iterator end() { return m_Vector.end(); }
-
- void insert(const PairType& pair);
- iterator find(const KeyT& key);
- void erase(iterator it);
-
-private:
- VmaVector< PairType, VmaStlAllocator<PairType> > m_Vector;
-};
-
-#define VMA_MAP_TYPE(KeyT, ValueT) VmaMap<KeyT, ValueT>
-
template<typename FirstT, typename SecondT>
struct VmaPairFirstLess
{
@@ -4995,7 +4917,33 @@
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.
+*/
+template<typename KeyT, typename ValueT>
+class VmaMap
+{
+public:
+ typedef VmaPair<KeyT, ValueT> PairType;
+ typedef PairType* iterator;
+
+ VmaMap(const VmaStlAllocator<PairType>& allocator) : m_Vector(allocator) {}
+
+ iterator begin() { return m_Vector.begin(); }
+ iterator end() { return m_Vector.end(); }
+
+ void insert(const PairType& pair);
+ iterator find(const KeyT& key);
+ void erase(iterator it);
+
+private:
+ VmaVector< PairType, VmaStlAllocator<PairType> > m_Vector;
+};
+
+#ifndef _VMA_MAP_FUNCTIONS
template<typename KeyT, typename ValueT>
void VmaMap<KeyT, ValueT>::insert(const PairType& pair)
{
@@ -5030,8 +4978,8 @@
{
VmaVectorRemove(m_Vector, it - m_Vector.begin());
}
-
-#endif // #if VMA_USE_STL_UNORDERED_MAP
+#endif // _VMA_MAP_FUNCTIONS
+#endif // _VMA_MAP
#endif // #if 0
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6e77d2c..f899312 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -47,7 +47,6 @@
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}>
diff --git a/src/VmaReplay/VmaUsage.h b/src/VmaReplay/VmaUsage.h
index 36c9a1f..68d30c1 100644
--- a/src/VmaReplay/VmaUsage.h
+++ b/src/VmaReplay/VmaUsage.h
@@ -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