-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Quote from https://howtovulkan.com/:
The specific flags combination of
VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BITandVMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BITused here make sure we get a memory type that's located on the GPU (in VRAM) and accessible by the host.
Meanwhile, quote from VMA / vk_mem_alloc.h:
Together with
VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BITorVMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
it says that despite request for host access, a not-HOST_VISIBLEmemory type can be selected if it may improve performance.By using this flag, you declare that you will check if the allocation ended up in a
HOST_VISIBLEmemory type (e.g. using vmaGetAllocationMemoryProperties()) and if not, you will create some "staging" buffer and issue an explicit transfer to write/read your data.To prepare for this possibility, don't forget to add appropriate flags like
VK_BUFFER_USAGE_TRANSFER_DST_BIT,VK_BUFFER_USAGE_TRANSFER_SRC_BITto the parameters of created buffer or image.
To me it seems VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT might not be used correctly in this sample. I believe either the bit should be dropped, or else the sample would need to check if the memory ends up host visible and deal with the case when it is not.