VMA_MEMORY_USAGE_AUTO* flags: Added support for rare case when a resource used on the device, not used on the host, may still be preferred in host memory

An update in the documentation.
This commit is contained in:
Adam Sawicki 2022-02-26 11:49:51 +01:00
parent 75446de4cc
commit 86c124c772

View File

@ -600,7 +600,7 @@ typedef enum VmaAllocationCreateFlagBits
This includes allocations created in \ref custom_memory_pools. This includes allocations created in \ref custom_memory_pools.
Declares that mapped memory can be read, written, and accessed in random order, Declares that mapped memory can be read, written, and accessed in random order,
so a `HOST_CACHED` memory type is preferred. so a `HOST_CACHED` memory type is required.
*/ */
VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT = 0x00000800, VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT = 0x00000800,
/** /**
@ -3639,6 +3639,10 @@ static bool FindMemoryPreferences(
// GPU access, no CPU access (e.g. a color attachment image) - prefer GPU memory // GPU access, no CPU access (e.g. a color attachment image) - prefer GPU memory
if(deviceAccess) if(deviceAccess)
{ {
// ...unless there is a clear preference from the user not to do so.
if(preferHost)
outNotPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
else
outPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; outPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
} }
// No direct GPU access, no CPU access, just transfers. // No direct GPU access, no CPU access, just transfers.