Copy commands are special transfer commands that transfer data contents from one memory region to another. These regions could be between buffers objects, image objects, and buffer-to-image and vice versa.
Depending upon the application need, you may need to copy data between buffers and images in various situations. There are four types of copy commands available to accomplish this job:
vkCmdCopyBuffer
: Data contents are copied from the source buffer to the destination buffer object's device memoryvkCmdCopyImage
: A specific portion of the source image object is copied to the destination image regionvkCmdCopyBufferToImage
: Buffer object data contents are copied to the image objectsvkCmdCopyImageToBuffer
: Image object data contents are copied to the buffer objectsIn the optimal tiling implementation, we used vkCmdCopyBufferToImage
. The following is the syntax:
void vkCmdCopyBufferToImage( VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions);
This API accepts six parameters, which are explained in the following table:
Parameters |
Description |
|
The |
|
This refers to the source buffer ( |
|
This refers to the destination image ( |
|
This is the |
|
This is the total count of the copy regions upon which the transfer of data contents will be performed. |
|
This field is a pointer to an array of |
In the next section, we will update the descriptor set with the image object, which contains the image layouts and image views, and render the image object on the 3D cube.
3.138.37.191