vulkan

CPU reading while GPU is copying


Is it safe to have the CPU read from a buffer while the same buffer is being used by the GPU as the source of a transfer operation using vkCmdCopyBuffer?

I am asking because I've read that even if the buffer is used as the source of a transfer, the vkCmdCopyBuffer itself may be more complex than a simple GPU read, and thus requires explicit host synchronization (i.e: the copy must have been completed before the CPU can read from the buffer). I can't find anything confirming this tho.


Solution

  • The Vulkan memory model only requires synchronization to ensure the availability, visibility, and memory domain of write operations. If the write operations that put data into that memory have already ensured that those writes are available and visible to both the host and the GPU copy operations, then neither read operation affects the other.