From 4dfa169ffc65583cd35bdb7ec13057cde8897c66 Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Mon, 22 Feb 2021 14:18:34 +0100 Subject: [PATCH] Fix for build on Linux --- premake/premake5.lua | 3 +-- src/vk_mem_alloc.h | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/premake/premake5.lua b/premake/premake5.lua index f6b8f5a..5110656 100644 --- a/premake/premake5.lua +++ b/premake/premake5.lua @@ -8,6 +8,7 @@ platforms { "x64", "Linux-x64" } location "../build" filename ("VulkanSample_" .. _SUFFIX) startproject "VulkanSample" +cppdialect "C++14" filter "platforms:x64" system "Windows" @@ -50,7 +51,6 @@ defines { "WIN32", "_CONSOLE", "PROFILE", "_WINDOWS", "_WIN32_WINNT=0x0601" } links { "vulkan-1" } filter { "platforms:Linux-x64" } -buildoptions { "-std=c++0x" } links { "vulkan" } filter { "configurations:Debug", "platforms:x64" } @@ -89,7 +89,6 @@ defines { "WIN32", "_CONSOLE", "PROFILE", "_WINDOWS", "_WIN32_WINNT=0x0601" } links { "vulkan-1" } filter { "platforms:Linux-x64" } -buildoptions { "-std=c++0x" } links { "vulkan" } filter { "configurations:Debug", "platforms:x64" } diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h index be21d44..3a7ae8d 100644 --- a/src/vk_mem_alloc.h +++ b/src/vk_mem_alloc.h @@ -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. -template +template struct AtomicTransactionalIncrement { public: + typedef std::atomic AtomicT; ~AtomicTransactionalIncrement() { if(m_Atomic) --(*m_Atomic); } - typename AtomicT::value_type Increment(AtomicT* atomic) + T Increment(AtomicT* atomic) { m_Atomic = atomic; return m_Atomic->fetch_add(1); @@ -17219,7 +17220,7 @@ private: VkResult VmaAllocator_T::AllocateVulkanMemory(const VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory) { - AtomicTransactionalIncrement deviceMemoryCountIncrement; + AtomicTransactionalIncrement deviceMemoryCountIncrement; const uint64_t prevDeviceMemoryCount = deviceMemoryCountIncrement.Increment(&m_DeviceMemoryCount); #if VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT if(prevDeviceMemoryCount >= m_PhysicalDeviceProperties.limits.maxMemoryAllocationCount)