Staging resources are used to update the contents of a memory that is not host-visible. Such memory cannot be mapped, so we need an intermediate buffer whose contents can be easily mapped and updated, and from which data can be transferred.
Using a staging buffer to update a buffer with a device-local memory bound
How to do it...
- Take the handle of a logical device stored in a variable of type VkDevice named logical_device.
- Prepare the data that should be uploaded to the target buffer. Set up a pointer to the beginning of a data source and store it in a variable of type void* named data. The size of the data (in bytes) should be represented with a variable of type VkDeviceSize named data_size.
- Create a variable of type VkBuffer named staging_buffer. In it, the...