Memory allocation and binding image resources
When an image resource object (VkImage
) is created, it contains a logical allocation. The image has no physical association with the device memory at that point. The actual memory backing is provided separately at a later stage. The physical allocation is very type-dependent; the images can be categorized into sparse and non-sparse. The sparse resource is specified using sparse creation flags (VkImageCreateFlagBits
in VkImageCreateInfo
); however, if the flag is not specified, it is a non-sparse image resource. This chapter will only address non-sparse memory as a reference. For more information on sparse resource allocation, refer to the official Vulkan 1.0 specification.
The association of an image with memory is a three-step process: gathering memory allocation requirements for image allocation, allocating the physical chunk on the device memory, and binding the allocated memory to the image resource. Let's take a look at this in detail.