C Specification
The VkImageMemoryBarrier2KHR
structure is defined as:
// Provided by VK_KHR_synchronization2
typedef struct VkImageMemoryBarrier2KHR {
VkStructureType sType;
const void* pNext;
VkPipelineStageFlags2KHR srcStageMask;
VkAccessFlags2KHR srcAccessMask;
VkPipelineStageFlags2KHR dstStageMask;
VkAccessFlags2KHR dstAccessMask;
VkImageLayout oldLayout;
VkImageLayout newLayout;
uint32_t srcQueueFamilyIndex;
uint32_t dstQueueFamilyIndex;
VkImage image;
VkImageSubresourceRange subresourceRange;
} VkImageMemoryBarrier2KHR;
Members
-
sType
is the type of this structure. -
pNext
isNULL
or a pointer to a structure extending this structure. -
srcStageMask
is a VkPipelineStageFlags2KHR mask of pipeline stages to be included in the first synchronization scope. -
srcAccessMask
is a VkAccessFlags2KHR mask of access flags to be included in the first access scope. -
dstStageMask
is a VkPipelineStageFlags2KHR mask of pipeline stages to be included in the second synchronization scope. -
dstAccessMask
is a VkAccessFlags2KHR mask of access flags to be included in the second access scope. -
oldLayout
is the old layout in an image layout transition. -
newLayout
is the new layout in an image layout transition. -
srcQueueFamilyIndex
is the source queue family for a queue family ownership transfer. -
dstQueueFamilyIndex
is the destination queue family for a queue family ownership transfer. -
image
is a handle to the image affected by this barrier. -
subresourceRange
describes the image subresource range withinimage
that is affected by this barrier.
Description
This structure defines a memory dependency limited to an image subresource range, and can define a queue family transfer operation and image layout transition for that subresource range.
The first synchronization scope and
access scope described by
this structure include only operations and memory accesses specified by
srcStageMask
and srcAccessMask
.
The second synchronization scope
and access scope described
by this structure include only operations and memory accesses specified by
dstStageMask
and dstAccessMask
.
Both access scopes are
limited to only memory accesses to image
in the subresource range
defined by subresourceRange
.
If image
was created with VK_SHARING_MODE_EXCLUSIVE
, and
srcQueueFamilyIndex
is not equal to dstQueueFamilyIndex
, this
memory barrier defines a queue family
transfer operation.
When executed on a queue in the family identified by
srcQueueFamilyIndex
, this barrier defines a
queue family release operation
for the specified image subresource range, and the second synchronization
and access scopes do not synchronize operations on that queue.
When executed on a queue in the family identified by
dstQueueFamilyIndex
, this barrier defines a
queue family acquire operation
for the specified image subresource range, and the first synchronization and
access scopes do not synchronize operations on that queue.
A queue family transfer operation is
also defined if the values are not equal, and either is one of the special
queue family values reserved for external memory ownership transfers, as
described in https://www.khronos.org/registry/vulkansc/specs/1.0-extensions/html/vkspec.html#synchronization-queue-transfers.
A queue family release
operation is defined when dstQueueFamilyIndex
is one of those
values, and a queue family
acquire operation is defined when srcQueueFamilyIndex
is one of
those values.
If oldLayout
is not equal to newLayout
, then the memory barrier
defines an image layout
transition for the specified image subresource range.
If this memory barrier defines a queue
family transfer operation, the layout transition is only executed once
between the queues.
Note
When the old and new layout are equal, the layout values are ignored - data is preserved no matter what values are specified, or what layout the image is currently in. |
If image
has a multi-planar format and the image is disjoint, then
including VK_IMAGE_ASPECT_COLOR_BIT
in the aspectMask
member of
subresourceRange
is equivalent to including
VK_IMAGE_ASPECT_PLANE_0_BIT
, VK_IMAGE_ASPECT_PLANE_1_BIT
, and
(for three-plane formats only) VK_IMAGE_ASPECT_PLANE_2_BIT
.
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.