Added VMA_CLASS_NO_COPY to silence warning in Visual Studio 2012 compiler: C4512 "class' : assignment operator could not be generated". Thanks @DominikWitczakAMD !

This commit is contained in:
Adam Sawicki 2018-04-11 15:51:03 +02:00
parent 5391e6c7fa
commit f8e5c145d1

View File

@ -2447,6 +2447,13 @@ If providing your own implementation, you need to implement a subset of std::ato
#define VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE (256ull * 1024 * 1024) #define VMA_DEFAULT_LARGE_HEAP_BLOCK_SIZE (256ull * 1024 * 1024)
#endif #endif
#ifndef VMA_CLASS_NO_COPY
#define VMA_CLASS_NO_COPY(className) \
private: \
className(const className&) = delete; \
className& operator=(const className&) = delete;
#endif
static const uint32_t VMA_FRAME_INDEX_LOST = UINT32_MAX; static const uint32_t VMA_FRAME_INDEX_LOST = UINT32_MAX;
/******************************************************************************* /*******************************************************************************
@ -2598,6 +2605,7 @@ static inline bool VmaIsBufferImageGranularityConflict(
// Helper RAII class to lock a mutex in constructor and unlock it in destructor (at the end of scope). // Helper RAII class to lock a mutex in constructor and unlock it in destructor (at the end of scope).
struct VmaMutexLock struct VmaMutexLock
{ {
VMA_CLASS_NO_COPY(VmaMutexLock)
public: public:
VmaMutexLock(VMA_MUTEX& mutex, bool useMutex) : VmaMutexLock(VMA_MUTEX& mutex, bool useMutex) :
m_pMutex(useMutex ? &mutex : VMA_NULL) m_pMutex(useMutex ? &mutex : VMA_NULL)
@ -3053,6 +3061,7 @@ allocator can create multiple blocks.
template<typename T> template<typename T>
class VmaPoolAllocator class VmaPoolAllocator
{ {
VMA_CLASS_NO_COPY(VmaPoolAllocator)
public: public:
VmaPoolAllocator(const VkAllocationCallbacks* pAllocationCallbacks, size_t itemsPerBlock); VmaPoolAllocator(const VkAllocationCallbacks* pAllocationCallbacks, size_t itemsPerBlock);
~VmaPoolAllocator(); ~VmaPoolAllocator();
@ -3185,6 +3194,7 @@ struct VmaListItem
template<typename T> template<typename T>
class VmaRawList class VmaRawList
{ {
VMA_CLASS_NO_COPY(VmaRawList)
public: public:
typedef VmaListItem<T> ItemType; typedef VmaListItem<T> ItemType;
@ -3223,10 +3233,6 @@ private:
ItemType* m_pFront; ItemType* m_pFront;
ItemType* m_pBack; ItemType* m_pBack;
size_t m_Count; size_t m_Count;
// Declared not defined, to block copy constructor and assignment operator.
VmaRawList(const VmaRawList<T>& src);
VmaRawList<T>& operator=(const VmaRawList<T>& rhs);
}; };
template<typename T> template<typename T>
@ -3455,6 +3461,7 @@ VmaListItem<T>* VmaRawList<T>::InsertAfter(ItemType* pItem, const T& value)
template<typename T, typename AllocatorT> template<typename T, typename AllocatorT>
class VmaList class VmaList
{ {
VMA_CLASS_NO_COPY(VmaList)
public: public:
class iterator class iterator
{ {
@ -3746,6 +3753,7 @@ class VmaDeviceMemoryBlock;
struct VmaAllocation_T struct VmaAllocation_T
{ {
VMA_CLASS_NO_COPY(VmaAllocation_T)
private: private:
static const uint8_t MAP_COUNT_FLAG_PERSISTENT_MAP = 0x80; static const uint8_t MAP_COUNT_FLAG_PERSISTENT_MAP = 0x80;
@ -3988,6 +3996,7 @@ in a single VkDeviceMemory block.
*/ */
class VmaBlockMetadata class VmaBlockMetadata
{ {
VMA_CLASS_NO_COPY(VmaBlockMetadata)
public: public:
VmaBlockMetadata(VmaAllocator hAllocator); VmaBlockMetadata(VmaAllocator hAllocator);
~VmaBlockMetadata(); ~VmaBlockMetadata();
@ -4091,6 +4100,7 @@ Thread-safety: This class must be externally synchronized.
*/ */
class VmaDeviceMemoryBlock class VmaDeviceMemoryBlock
{ {
VMA_CLASS_NO_COPY(VmaDeviceMemoryBlock)
public: public:
VmaBlockMetadata m_Metadata; VmaBlockMetadata m_Metadata;
@ -4159,6 +4169,8 @@ Synchronized internally with a mutex.
*/ */
struct VmaBlockVector struct VmaBlockVector
{ {
VMA_CLASS_NO_COPY(VmaBlockVector)
public:
VmaBlockVector( VmaBlockVector(
VmaAllocator hAllocator, VmaAllocator hAllocator,
uint32_t memoryTypeIndex, uint32_t memoryTypeIndex,
@ -4248,6 +4260,7 @@ private:
struct VmaPool_T struct VmaPool_T
{ {
VMA_CLASS_NO_COPY(VmaPool_T)
public: public:
VmaBlockVector m_BlockVector; VmaBlockVector m_BlockVector;
@ -4266,6 +4279,8 @@ public:
class VmaDefragmentator class VmaDefragmentator
{ {
VMA_CLASS_NO_COPY(VmaDefragmentator)
private:
const VmaAllocator m_hAllocator; const VmaAllocator m_hAllocator;
VmaBlockVector* const m_pBlockVector; VmaBlockVector* const m_pBlockVector;
uint32_t m_CurrentFrameIndex; uint32_t m_CurrentFrameIndex;
@ -4395,6 +4410,8 @@ public:
// Main allocator object. // Main allocator object.
struct VmaAllocator_T struct VmaAllocator_T
{ {
VMA_CLASS_NO_COPY(VmaAllocator_T)
public:
bool m_UseMutex; bool m_UseMutex;
bool m_UseKhrDedicatedAllocation; bool m_UseKhrDedicatedAllocation;
VkDevice m_hDevice; VkDevice m_hDevice;
@ -4664,6 +4681,7 @@ void VmaStringBuilder::AddPointer(const void* ptr)
class VmaJsonWriter class VmaJsonWriter
{ {
VMA_CLASS_NO_COPY(VmaJsonWriter)
public: public:
VmaJsonWriter(const VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder& sb); VmaJsonWriter(const VkAllocationCallbacks* pAllocationCallbacks, VmaStringBuilder& sb);
~VmaJsonWriter(); ~VmaJsonWriter();