VkBufferMemoryBarrier(3)

Name

VkBufferMemoryBarrier - Structure specifying a buffer memory barrier

C Specification

The VkBufferMemoryBarrier structure is defined as:

// Provided by VK_VERSION_1_0
typedef struct VkBufferMemoryBarrier {
    VkStructureType    sType;
    const void*        pNext;
    VkAccessFlags      srcAccessMask;
    VkAccessFlags      dstAccessMask;
    uint32_t           srcQueueFamilyIndex;
    uint32_t           dstQueueFamilyIndex;
    VkBuffer           buffer;
    VkDeviceSize       offset;
    VkDeviceSize       size;
} VkBufferMemoryBarrier;

Members

Description

The first access scope is limited to access to memory through the specified buffer range, via access types in the source access mask specified by srcAccessMask and, if a VkMemoryBarrierAccessFlags3KHR is passed in pNext, srcAccessMask3. If the source access mask includes VK_ACCESS_HOST_WRITE_BIT, a memory domain operation is performed where available memory in the host domain is also made available to the device domain.

The second access scope is limited to access to memory through the specified buffer range, via access types in the destination access mask specified by dstAccessMask and, if a VkMemoryBarrierAccessFlags3KHR is passed in pNext, dstAccessMask3. If the destination access mask includes VK_ACCESS_HOST_WRITE_BIT or VK_ACCESS_HOST_READ_BIT, a memory domain operation is performed where available memory in the device domain is also made available to the host domain.

Host writes to device memory that was allocated without VK_MEMORY_PROPERTY_HOST_COHERENT_BIT have to be flushed with vkFlushMappedMemoryRanges before they can be accessed safely on the device. Similarly, device writes to such memory have to be invalidated with vkInvalidateMappedMemoryRanges before they can be accessed safely on the host.

Memory allocated with VK_MEMORY_PROPERTY_HOST_COHERENT_BIT does not need to have these additional operations performed.

If srcQueueFamilyIndex is not equal to dstQueueFamilyIndex, and srcQueueFamilyIndex is equal to the current queue family, then the memory barrier defines a queue family release operation for the specified buffer range, and if dependencyFlags did not include VK_DEPENDENCY_QUEUE_FAMILY_OWNERSHIP_TRANSFER_USE_ALL_STAGES_BIT_KHR, the second synchronization scope of the calling command does not apply to this operation.

If dstQueueFamilyIndex is not equal to srcQueueFamilyIndex, and dstQueueFamilyIndex is equal to the current queue family, then the memory barrier defines a queue family acquire operation for the specified buffer range, and if dependencyFlags did not include VK_DEPENDENCY_QUEUE_FAMILY_OWNERSHIP_TRANSFER_USE_ALL_STAGES_BIT_KHR, the first synchronization scope of the calling command does not apply to this operation.

Valid Usage
Valid Usage (Implicit)
  • VUID-VkBufferMemoryBarrier-sType-sType
    sType must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER

  • VUID-VkBufferMemoryBarrier-pNext-pNext
    pNext must be NULL or a pointer to a valid instance of VkExternalMemoryAcquireUnmodifiedEXT

  • VUID-VkBufferMemoryBarrier-sType-unique
    The sType value of each structure in the pNext chain must be unique

  • VUID-VkBufferMemoryBarrier-buffer-parameter
    buffer must be a valid VkBuffer handle

Document Notes

For more information, see the Vulkan Specification.

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.