VmaBlockVector::Defragment: Minor fix for case when VMA_DEBUG_DETECT_CORRUPTION != 0.

This commit is contained in:
Adam Sawicki 2018-12-10 13:32:55 +01:00
parent e31dd15ff5
commit 58a9e406f1

View File

@ -12119,9 +12119,13 @@ void VmaBlockVector::Defragment(
const VkMemoryPropertyFlags memPropFlags = const VkMemoryPropertyFlags memPropFlags =
m_hAllocator->m_MemProps.memoryTypes[m_MemoryTypeIndex].propertyFlags; m_hAllocator->m_MemProps.memoryTypes[m_MemoryTypeIndex].propertyFlags;
const bool isHostVisible = (memPropFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0;
const bool isHostCoherent = (memPropFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) != 0;
const bool canDefragmentOnCpu = maxCpuBytesToMove > 0 && maxCpuAllocationsToMove > 0 && const bool canDefragmentOnCpu = maxCpuBytesToMove > 0 && maxCpuAllocationsToMove > 0 &&
(memPropFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0; isHostVisible;
const bool canDefragmentOnGpu = maxGpuBytesToMove > 0 && maxGpuAllocationsToMove > 0; const bool canDefragmentOnGpu = maxGpuBytesToMove > 0 && maxGpuAllocationsToMove > 0 &&
(VMA_DEBUG_DETECT_CORRUPTION == 0 || !(isHostVisible && isHostCoherent));
// There are options to defragment this memory type. // There are options to defragment this memory type.
if(canDefragmentOnCpu || canDefragmentOnGpu) if(canDefragmentOnCpu || canDefragmentOnGpu)