Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-sawicki-a committed Dec 2, 2019
2 parents cd7bc20 + 5f94eae commit 7d6544d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/vk_mem_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6278,7 +6278,7 @@ struct VmaBlockVector

void GetPoolStats(VmaPoolStats* pStats);

bool IsEmpty() const { return m_Blocks.empty(); }
bool IsEmpty();
bool IsCorruptionDetectionEnabled() const;

VkResult Allocate(
Expand Down Expand Up @@ -11827,6 +11827,12 @@ void VmaBlockVector::GetPoolStats(VmaPoolStats* pStats)
}
}

bool VmaBlockVector::IsEmpty()
{
VmaMutexLockRead lock(m_Mutex, m_hAllocator->m_UseMutex);
return m_Blocks.empty();
}

bool VmaBlockVector::IsCorruptionDetectionEnabled() const
{
const uint32_t requiredMemFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
Expand Down Expand Up @@ -15864,7 +15870,7 @@ VkResult VmaAllocator_T::AllocateVulkanMemory(const VkMemoryAllocateInfo* pAlloc
{
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
}
if(m_Budget.m_BlockBytes->compare_exchange_strong(blockBytes, blockBytesAfterAllocation))
if(m_Budget.m_BlockBytes[heapIndex].compare_exchange_strong(blockBytes, blockBytesAfterAllocation))
{
break;
}
Expand Down

0 comments on commit 7d6544d

Please sign in to comment.