Skip to content

Commit

Permalink
Fix for build on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-sawicki-a committed Feb 22, 2021
1 parent ae0b011 commit 4dfa169
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions premake/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ platforms { "x64", "Linux-x64" }
location "../build"
filename ("VulkanSample_" .. _SUFFIX)
startproject "VulkanSample"
cppdialect "C++14"

filter "platforms:x64"
system "Windows"
Expand Down Expand Up @@ -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" }
Expand Down Expand Up @@ -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" }
Expand Down
7 changes: 4 additions & 3 deletions src/vk_mem_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<typename AtomicT>
template<typename T>
struct AtomicTransactionalIncrement
{
public:
typedef std::atomic<T> 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);
Expand All @@ -17219,7 +17220,7 @@ struct AtomicTransactionalIncrement

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);
#if VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT
if(prevDeviceMemoryCount >= m_PhysicalDeviceProperties.limits.maxMemoryAllocationCount)
Expand Down

0 comments on commit 4dfa169

Please sign in to comment.