Fix atomic type used in AtomicTransactionalIncrement

This partially reverts changes from 4dfa169ffc
This commit is contained in:
Denis Orlov 2023-01-04 17:10:15 +03:00
parent 413fc4f988
commit 3459fd780a

View File

@ -4002,12 +4002,10 @@ private:
#ifndef _VMA_ATOMIC_TRANSACTIONAL_INCREMENT
// An object that increments given atomic but decrements it back in the destructor unless Commit() is called.
template<typename T>
template<typename AtomicT>
struct AtomicTransactionalIncrement
{
public:
typedef std::atomic<T> AtomicT;
~AtomicTransactionalIncrement()
{
if(m_Atomic)
@ -4015,7 +4013,7 @@ public:
}
void Commit() { m_Atomic = nullptr; }
T Increment(AtomicT* atomic)
typename AtomicT::value_type Increment(AtomicT* atomic)
{
m_Atomic = atomic;
return m_Atomic->fetch_add(1);
@ -15374,7 +15372,7 @@ VkResult VmaAllocator_T::CheckCorruption(uint32_t memoryTypeBits)
VkResult VmaAllocator_T::AllocateVulkanMemory(const VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory)
{
AtomicTransactionalIncrement<uint32_t> deviceMemoryCountIncrement;
AtomicTransactionalIncrement<VMA_ATOMIC_UINT32> deviceMemoryCountIncrement;
const uint64_t prevDeviceMemoryCount = deviceMemoryCountIncrement.Increment(&m_DeviceMemoryCount);
#if VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT
if(prevDeviceMemoryCount >= m_PhysicalDeviceProperties.limits.maxMemoryAllocationCount)