Fix for build on Linux

This commit is contained in:
Adam Sawicki 2021-02-22 14:18:34 +01:00
parent ae0b011e7a
commit 4dfa169ffc
2 changed files with 5 additions and 5 deletions

View File

@ -8,6 +8,7 @@ platforms { "x64", "Linux-x64" }
location "../build" location "../build"
filename ("VulkanSample_" .. _SUFFIX) filename ("VulkanSample_" .. _SUFFIX)
startproject "VulkanSample" startproject "VulkanSample"
cppdialect "C++14"
filter "platforms:x64" filter "platforms:x64"
system "Windows" system "Windows"
@ -50,7 +51,6 @@ defines { "WIN32", "_CONSOLE", "PROFILE", "_WINDOWS", "_WIN32_WINNT=0x0601" }
links { "vulkan-1" } links { "vulkan-1" }
filter { "platforms:Linux-x64" } filter { "platforms:Linux-x64" }
buildoptions { "-std=c++0x" }
links { "vulkan" } links { "vulkan" }
filter { "configurations:Debug", "platforms:x64" } filter { "configurations:Debug", "platforms:x64" }
@ -89,7 +89,6 @@ defines { "WIN32", "_CONSOLE", "PROFILE", "_WINDOWS", "_WIN32_WINNT=0x0601" }
links { "vulkan-1" } links { "vulkan-1" }
filter { "platforms:Linux-x64" } filter { "platforms:Linux-x64" }
buildoptions { "-std=c++0x" }
links { "vulkan" } links { "vulkan" }
filter { "configurations:Debug", "platforms:x64" } filter { "configurations:Debug", "platforms:x64" }

View File

@ -17194,16 +17194,17 @@ void VmaAllocator_T::CreateLostAllocation(VmaAllocation* pAllocation)
} }
// An object that increments given atomic but decrements it back in the destructor unless Commit() is called. // An object that increments given atomic but decrements it back in the destructor unless Commit() is called.
template<typename AtomicT> template<typename T>
struct AtomicTransactionalIncrement struct AtomicTransactionalIncrement
{ {
public: public:
typedef std::atomic<T> AtomicT;
~AtomicTransactionalIncrement() ~AtomicTransactionalIncrement()
{ {
if(m_Atomic) if(m_Atomic)
--(*m_Atomic); --(*m_Atomic);
} }
typename AtomicT::value_type Increment(AtomicT* atomic) T Increment(AtomicT* atomic)
{ {
m_Atomic = atomic; m_Atomic = atomic;
return m_Atomic->fetch_add(1); return m_Atomic->fetch_add(1);
@ -17219,7 +17220,7 @@ private:
VkResult VmaAllocator_T::AllocateVulkanMemory(const VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory) VkResult VmaAllocator_T::AllocateVulkanMemory(const VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory)
{ {
AtomicTransactionalIncrement<VMA_ATOMIC_UINT32> deviceMemoryCountIncrement; AtomicTransactionalIncrement<uint32_t> deviceMemoryCountIncrement;
const uint64_t prevDeviceMemoryCount = deviceMemoryCountIncrement.Increment(&m_DeviceMemoryCount); const uint64_t prevDeviceMemoryCount = deviceMemoryCountIncrement.Increment(&m_DeviceMemoryCount);
#if VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT #if VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT
if(prevDeviceMemoryCount >= m_PhysicalDeviceProperties.limits.maxMemoryAllocationCount) if(prevDeviceMemoryCount >= m_PhysicalDeviceProperties.limits.maxMemoryAllocationCount)