VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT usage

Open
#14 3 comments 3 reactions 1 assignee View on GitHub

@SaschaWillems is already working on this.

Since Jan 8, 2026.

Assessment

This issue has not been assessed yet.

Description

Quote from https://howtovulkan.com/:

The specific flags combination of VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT and VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT used 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_BIT or VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
it says that despite request for host access, a not-HOST_VISIBLE memory 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_VISIBLE memory 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_BIT to 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.

Dominant language
C++
Stars
681
Forks
63
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SaschaWillems/HowToVulkan

All issues in SaschaWillems/HowToVulkan

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.