Changed heuristic in FindMemoryPreferences when VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT is used Hopefully fixes https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/issues/520
diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index 263d0c8..2479285 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h
@@ -4265,8 +4265,11 @@ } else { - // Always CPU memory. - outRequiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; + if(hostAccessAllowTransferInstead) + outPreferredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; + else + // Always CPU memory. + outRequiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; } } // CPU sequential write - may be CPU or host-visible GPU memory, uncached and write-combined. @@ -4281,7 +4284,12 @@ } else { - outRequiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; + if(hostAccessAllowTransferInstead) + outPreferredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; + else + // Always CPU memory. + outRequiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; + // Direct GPU access, CPU sequential write (e.g. a dynamic uniform buffer updated every frame) if(deviceAccess) {