VkImageMemoryBarrier
The VkImageMemoryBarrier structure is defined as:
typedef struct VkImageMemoryBarrier {
VkStructureType sType;
const void* pNext;
VkAccessFlags srcAccessMask;
VkAccessFlags dstAccessMask;
VkImageLayout oldLayout;
VkImageLayout newLayout;
uint32_t srcQueueFamilyIndex;
uint32_t dstQueueFamilyIndex;
VkImage image;
VkImageSubresourceRange subresourceRange;
} VkImageMemoryBarrier;
sTypeis a VkStructureType value identifying this structure.pNextisNULLor a pointer to a structure extending this structure.srcAccessMaskis a bitmask of VkAccessFlagBits specifying a source access mask.dstAccessMaskis a bitmask of VkAccessFlagBits specifying a destination access mask.oldLayoutis the old layout in an image layout transition.newLayoutis the new layout in an image layout transition.srcQueueFamilyIndexis the source queue family for a queue family ownership transfer.dstQueueFamilyIndexis the destination queue family for a queue family ownership transfer.imageis a handle to the image affected by this barrier.subresourceRangedescribes the image subresource range withinimagethat is affected by this barrier.
The first access scope is
limited to access to memory through the specified image subresource range,
via access types in the source access mask
specified by srcAccessMask.
If srcAccessMask includes VK_ACCESS_HOST_WRITE_BIT, memory
writes performed by that access type are also made visible, as that access
type is not performed through a resource.
The second access scope is
limited to access to memory through the specified image subresource range,
via access types in the destination access
mask specified by dstAccessMask.
If dstAccessMask includes VK_ACCESS_HOST_WRITE_BIT or
VK_ACCESS_HOST_READ_BIT, available memory writes are also made visible
to accesses of those types, as those access types are not performed through
a resource.
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 image subresource 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 image subresource 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.
If the synchronization2 feature is not
enabled or oldLayout is not equal to newLayout,
oldLayout and newLayout define an
image layout transition for
the specified image subresource range.
If the synchronization2 feature is
enabled, 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.
Valid Usage
VUID-VkImageMemoryBarrier-oldLayout-01208
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL then image must
have been created with VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
VUID-VkImageMemoryBarrier-oldLayout-01209
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL then imagemust have been created with
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
VUID-VkImageMemoryBarrier-oldLayout-01210
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL then imagemust have been created with
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
VUID-VkImageMemoryBarrier-oldLayout-01211
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL then image must
have been created with VK_IMAGE_USAGE_SAMPLED_BIT or
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
VUID-VkImageMemoryBarrier-oldLayout-01212
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL then image must have
been created with VK_IMAGE_USAGE_TRANSFER_SRC_BIT
VUID-VkImageMemoryBarrier-oldLayout-01213
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL then image must have
been created with VK_IMAGE_USAGE_TRANSFER_DST_BIT
VUID-VkImageMemoryBarrier-oldLayout-01197
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
oldLayout must be VK_IMAGE_LAYOUT_UNDEFINED or the current
layout of the image subresources affected by the barrier
VUID-VkImageMemoryBarrier-newLayout-01198
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
newLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or
VK_IMAGE_LAYOUT_PREINITIALIZED
VUID-VkImageMemoryBarrier-oldLayout-01658
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL then
image must have been created with
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
VUID-VkImageMemoryBarrier-oldLayout-01659
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL then
image must have been created with
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
VUID-VkImageMemoryBarrier-synchronization2-07793
If the synchronization2 feature is
not enabled, oldLayout must not be
VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR or
VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR
VUID-VkImageMemoryBarrier-synchronization2-07794
If the synchronization2 feature is
not enabled, newLayout must not be
VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR or
VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-03938
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL, image must have been
created with VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT or
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-03939
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL, image must have been
created with at least one of
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
VK_IMAGE_USAGE_SAMPLED_BIT, or
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
VUID-VkImageMemoryBarrier-oldLayout-02088
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR then
image must have been created with
VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR set
VUID-VkImageMemoryBarrier-image-09117
If image was created with a sharing mode of
VK_SHARING_MODE_EXCLUSIVE, and srcQueueFamilyIndex and
dstQueueFamilyIndex are not equal, srcQueueFamilyIndex must
be
VK_QUEUE_FAMILY_EXTERNAL,
VK_QUEUE_FAMILY_FOREIGN_EXT,
or
a valid queue family
VUID-VkImageMemoryBarrier-image-09118
If image was created with a sharing mode of
VK_SHARING_MODE_EXCLUSIVE, and srcQueueFamilyIndex and
dstQueueFamilyIndex are not equal, dstQueueFamilyIndex must
be
VK_QUEUE_FAMILY_EXTERNAL,
VK_QUEUE_FAMILY_FOREIGN_EXT,
or
a valid queue family
VUID-VkImageMemoryBarrier-None-09119
If
the VK_KHR_external_memory extension is not enabled,
srcQueueFamilyIndex must not be VK_QUEUE_FAMILY_EXTERNAL
VUID-VkImageMemoryBarrier-None-09120
If
the VK_KHR_external_memory extension is not enabled,
dstQueueFamilyIndex must not be VK_QUEUE_FAMILY_EXTERNAL
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-09121
If the VK_EXT_queue_family_foreign extension is not enabled
srcQueueFamilyIndex must not be VK_QUEUE_FAMILY_FOREIGN_EXT
VUID-VkImageMemoryBarrier-dstQueueFamilyIndex-09122
If the VK_EXT_queue_family_foreign extension is not enabled
dstQueueFamilyIndex must not be VK_QUEUE_FAMILY_FOREIGN_EXT
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-07120
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR then image must have
been created with VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-07121
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR then image must have
been created with VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-07122
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR then image must have
been created with VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-07123
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR then image must have
been created with VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-07124
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_VIDEO_ENCODE_DST_KHR then image must have
been created with VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-07125
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR then image must have
been created with VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-10287
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_VIDEO_ENCODE_QUANTIZATION_MAP_KHR then imagemust have been created with
VK_IMAGE_USAGE_VIDEO_ENCODE_QUANTIZATION_DELTA_MAP_BIT_KHR or
VK_IMAGE_USAGE_VIDEO_ENCODE_EMPHASIS_MAP_BIT_KHR
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-07006
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT then
image must have been created with either the
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT or
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT usage bits, and the
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT or
VK_IMAGE_USAGE_SAMPLED_BIT usage bits, and the
VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT usage bit
VUID-VkImageMemoryBarrier-attachmentFeedbackLoopLayout-07313
If the attachmentFeedbackLoopLayout feature is not enabled,
newLayout must not be
VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT
VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-09550
If srcQueueFamilyIndex and dstQueueFamilyIndex define a
queue family ownership transfer or
oldLayout and newLayout define an
image layout transition,
and oldLayout or newLayout is
VK_IMAGE_LAYOUT_RENDERING_LOCAL_READ then image must have
been created with either VK_IMAGE_USAGE_STORAGE_BIT, or with both
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT and either of
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT or
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
VUID-VkImageMemoryBarrier-dynamicRenderingLocalRead-09551
If the dynamicRenderingLocalRead feature is not enabled,
oldLayout must not be VK_IMAGE_LAYOUT_RENDERING_LOCAL_READ
VUID-VkImageMemoryBarrier-dynamicRenderingLocalRead-09552
If the dynamicRenderingLocalRead feature is not enabled,
newLayout must not be VK_IMAGE_LAYOUT_RENDERING_LOCAL_READ
VUID-VkImageMemoryBarrier-subresourceRange-01486
subresourceRange.baseMipLevel must be less than the
mipLevels specified in VkImageCreateInfo when image
was created
VUID-VkImageMemoryBarrier-subresourceRange-01724
If subresourceRange.levelCount is not
VK_REMAINING_MIP_LEVELS, subresourceRange.baseMipLevel
+ subresourceRange.levelCount must be less than or equal to
the mipLevels specified in VkImageCreateInfo when
image was created
VUID-VkImageMemoryBarrier-subresourceRange-01488
subresourceRange.baseArrayLayer must be less than the
arrayLayers specified in VkImageCreateInfo when image
was created
VUID-VkImageMemoryBarrier-subresourceRange-01725
If subresourceRange.layerCount is not
VK_REMAINING_ARRAY_LAYERS,
subresourceRange.baseArrayLayer +
subresourceRange.layerCount must be less than or equal to the
arrayLayers specified in VkImageCreateInfo when image
was created
VUID-VkImageMemoryBarrier-image-01932
If image is non-sparse then it must be bound completely and
contiguously to a single VkDeviceMemory object
VUID-VkImageMemoryBarrier-image-09241
If image has a color format
that is single-plane,
then the aspectMask member of subresourceRange must be
VK_IMAGE_ASPECT_COLOR_BIT
VUID-VkImageMemoryBarrier-image-09242
If image has a color format and is not disjoint, then the
aspectMask member of subresourceRange must be
VK_IMAGE_ASPECT_COLOR_BIT
VUID-VkImageMemoryBarrier-image-01672
If image has a multi-planar format and
the image is disjoint, then the aspectMask member of
subresourceRange must include at least one
multi-planar aspect mask bit or
VK_IMAGE_ASPECT_COLOR_BIT
VUID-VkImageMemoryBarrier-image-03320
If image has a depth/stencil format with both depth and stencil
and the separateDepthStencilLayouts feature is not enabled,
then the aspectMask member of subresourceRange must include
both VK_IMAGE_ASPECT_DEPTH_BIT and
VK_IMAGE_ASPECT_STENCIL_BIT
VUID-VkImageMemoryBarrier-image-03319
If image has a depth/stencil format with both depth and stencil
and the separateDepthStencilLayouts feature is enabled, then the
aspectMask member of subresourceRange must include either
or both VK_IMAGE_ASPECT_DEPTH_BIT and
VK_IMAGE_ASPECT_STENCIL_BIT
VUID-VkImageMemoryBarrier-aspectMask-08702
If the aspectMask member of subresourceRange includes
VK_IMAGE_ASPECT_DEPTH_BIT, oldLayout and newLayoutmust not be one of VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or
VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL
VUID-VkImageMemoryBarrier-aspectMask-08703
If the aspectMask member of subresourceRange includes
VK_IMAGE_ASPECT_STENCIL_BIT, oldLayout and newLayoutmust not be one of VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or
VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL
VUID-VkImageMemoryBarrier-subresourceRange-09601
subresourceRange.aspectMask must be valid for the format
the image was created with
VUID-VkImageMemoryBarrier-None-09052
If
the synchronization2 feature is not
enabled, and
image was created with a sharing mode of
VK_SHARING_MODE_CONCURRENT, at least one of
srcQueueFamilyIndex and dstQueueFamilyIndex must be
VK_QUEUE_FAMILY_IGNORED
VUID-VkImageMemoryBarrier-None-09053
If
the synchronization2 feature is not
enabled, and
image was created with a sharing mode of
VK_SHARING_MODE_CONCURRENT, srcQueueFamilyIndex must be
VK_QUEUE_FAMILY_IGNORED
or VK_QUEUE_FAMILY_EXTERNAL
VUID-VkImageMemoryBarrier-None-09054
If
the synchronization2 feature is not
enabled, and
image was created with a sharing mode of
VK_SHARING_MODE_CONCURRENT, dstQueueFamilyIndex must be
VK_QUEUE_FAMILY_IGNORED
or VK_QUEUE_FAMILY_EXTERNAL
Valid Usage (Implicit)
VUID-VkImageMemoryBarrier-sType-sType
sType must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
VUID-VkImageMemoryBarrier-pNext-pNext
Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkExternalMemoryAcquireUnmodifiedEXT or VkSampleLocationsInfoEXT
VUID-VkImageMemoryBarrier-sType-unique
The sType value of each structure in the pNext chain must be unique
VUID-VkImageMemoryBarrier-oldLayout-parameter
oldLayout must be a valid VkImageLayout value
VUID-VkImageMemoryBarrier-newLayout-parameter
newLayout must be a valid VkImageLayout value
VUID-VkImageMemoryBarrier-image-parameter
image must be a valid VkImage handle
VUID-VkImageMemoryBarrier-subresourceRange-parameter
subresourceRange must be a valid VkImageSubresourceRange structure