Minor fixes in both the library and tests.

This commit is contained in:
Adam Sawicki 2019-01-24 16:21:05 +01:00
parent 4d35a5d663
commit 4d844e2d29
2 changed files with 17 additions and 4 deletions

View file

@ -11444,6 +11444,12 @@ VkResult VmaBlockVector::Allocate(
size_t allocIndex;
VkResult res = VK_SUCCESS;
if(IsCorruptionDetectionEnabled())
{
size = VmaAlignUp<VkDeviceSize>(size, sizeof(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));
alignment = VmaAlignUp<VkDeviceSize>(alignment, sizeof(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));
}
{
VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);
for(allocIndex = 0; allocIndex < allocationCount; ++allocIndex)
@ -12375,7 +12381,7 @@ void VmaBlockVector::Defragment(
const bool canDefragmentOnCpu = maxCpuBytesToMove > 0 && maxCpuAllocationsToMove > 0 &&
isHostVisible;
const bool canDefragmentOnGpu = maxGpuBytesToMove > 0 && maxGpuAllocationsToMove > 0 &&
(VMA_DEBUG_DETECT_CORRUPTION == 0 || !(isHostVisible && isHostCoherent));
!IsCorruptionDetectionEnabled();
// There are options to defragment this memory type.
if(canDefragmentOnCpu || canDefragmentOnGpu)