Function Prototype

vkCmdCopyImageToMemoryKHR

Copy data from an image to memory ranges

To copy data from an image to memory ranges, call:

void vkCmdCopyImageToMemoryKHR(
    VkCommandBuffer commandBuffer,
    const VkCopyDeviceMemoryImageInfoKHR* pCopyMemoryInfo);
  • commandBuffer is the command buffer into which the command will be recorded.
  • pCopyMemoryInfo a pointer to a VkCopyDeviceMemoryImageInfoKHR structure describing the copies to perform.

Valid Usage

VUID-vkCmdCopyImageToMemoryKHR-commandBuffer-13102

If commandBuffer is an unprotected command buffer and protectedNoFault is not supported, the addressCopyFlags member of all elements of pCopyMemoryInfo→pRegions must not include VK_ADDRESS_COMMAND_PROTECTED_BIT_KHR

VUID-vkCmdCopyImageToMemoryKHR-commandBuffer-13103

If commandBuffer is an unprotected command buffer and protectedNoFault is not supported, pCopyMemoryInfo→image must not have been created with VK_IMAGE_CREATE_PROTECTED_BIT

VUID-vkCmdCopyImageToMemoryKHR-commandBuffer-13104

If the queue family used to create the VkCommandPool which commandBuffer was allocated from does not support VK_QUEUE_GRAPHICS_BIT or VK_QUEUE_COMPUTE_BIT, the addressRange.pname:address member of any element of pCopyMemoryInfo→pRegions must be a multiple of 4

VUID-vkCmdCopyImageToMemoryKHR-imageOffset-13105

The imageOffset and imageExtent members of each element of pCopyMemoryInfo→pRegions must respect the image transfer granularity requirements of commandBuffer’s command pool’s queue family, as described in VkQueueFamilyProperties

VUID-vkCmdCopyImageToMemoryKHR-commandBuffer-13106

If the queue family used to create the VkCommandPool which commandBuffer was allocated from does not support VK_QUEUE_GRAPHICS_BIT, for each element of pCopyMemoryInfo→pRegions, the aspectMask member of imageSubresource must not be VK_IMAGE_ASPECT_DEPTH_BIT or VK_IMAGE_ASPECT_STENCIL_BIT

VUID-vkCmdCopyImageToMemoryKHR-imageLayout-13023

The imageLayout member of each element of pCopyMemoryInfo→pRegions must be VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR, or VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL

VUID-vkCmdCopyImageToMemoryKHR-pCopyMemoryInfo-13024

pCopyMemoryInfo→image must have been created with VK_IMAGE_USAGE_TRANSFER_SRC_BIT

VUID-vkCmdCopyImageToMemoryKHR-commandBuffer-13025

If commandBuffer is a protected command buffer and protectedNoFault is not supported, the addressCopyFlags member of all elements of pCopyMemoryInfo→pRegions must include VK_ADDRESS_COMMAND_PROTECTED_BIT_KHR

VUID-vkCmdCopyImageToMemoryKHR-addressRange-13129

At least one buffer containing the total address range specified by the addressRange member of each element of pCopyMemoryInfo→pRegions must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT

Valid Usage (Implicit)

VUID-vkCmdCopyImageToMemoryKHR-pCopyMemoryInfo-parameter

If pCopyMemoryInfo is not NULL, pCopyMemoryInfo must be a valid pointer to a valid VkCopyDeviceMemoryImageInfoKHR structure

VUID-vkCmdCopyImageToMemoryKHR-commandBuffer-cmdpool

The VkCommandPool that commandBuffer was allocated from must support VK_QUEUE_TRANSFER_BIT operations

VUID-vkCmdCopyImageToMemoryKHR-renderpass

This command must only be called outside of a render pass instance

VUID-vkCmdCopyImageToMemoryKHR-suspended

This command must not be called between suspended render pass instances

VUID-vkCmdCopyImageToMemoryKHR-videocoding

This command must only be called outside of a video coding scope

Host Synchronization

  • Host access to commandBuffer must be externally synchronized
  • Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized