For images, we can bind memory objects that are allocated from different memory types. Only host-visible memory can be mapped and updated directly from our application. When we want to update the memory of an image that uses a device-local memory, we need to copy data from a buffer.
Copying data from a buffer to an image
How to do it...
- Take the handle of a command buffer and store it in a variable of type VkCommandBuffer named command_buffer. Make sure the command buffer is already in a recording state (refer to the Beginning a command buffer recording operation recipe from Chapter 3, Command Buffers and Synchronization).
- Take a buffer from which data will be copied. Store its handle in a variable of type VkBuffer named source_buffer.
- Take the image to which...