Queue family ownership transfer granularity for VkBuffer

Viewed 70

Question: Are there any granularity/alignment requirements for transfering sub-regions of a VkBuffer from one queue family to another?

I would like to:

  1. use a single graphics/present queue for sourcing draw calls from a single VkBuffer;
  2. and another separate compute queue to fill sub-allocated regions/sections within said VkBuffer

So, commands submitted to the graphics/present queue (1.) will read/source data written to the VkBuffer by commands submitted to the compute queue (2.). And I do not want to transfer the whole VkBuffer from one queue to the other, but only certain sub-regions (once their computation is finished and the results can be consumed/sourced by the graphics commands).

I've read that whenever you use VK_SHARING_MODE_EXCLUSIVE VkSharingMode you must explicitly transfer ownership from one queue (in my case the compute queue) to the other queue (in my case the graphics/present queue) such that commands submitted to the latter queue sees the changes made by submitted commands in the former queue. I know how to do this and how to correctly synchronize both release and acquire actions with semaphores.

However, since I wanted to use a singe VkBuffer with manual sub-allocations (actually with VMA virtual allocations) and saw that VkBufferMemoryBarrier provides an offset and size properties, I was wondering whether there are any granularity requirements as for which sections/pages of a VkBuffer can be transferred.

Can I actually transfer single bytes of a VkBuffer from one queue family to another or do I have to obey certain granularity/alignment requirements (other than the alignment requirements for my own data structures within that VkBuffer and the usage of that buffer of course)?

1 Answers

There are no granularity requirements on queue family transfer byte ranges. Indeed, there do not appear to be granularity requirements on memory barrier byte ranges either.

Related