Image storage (1D, 2D, 3D, arrays, etc.) and image views.
An image is a region of memory whose purpose is to store multi-dimensional data. Its most common use is to store a 2D array of color pixels (in other words an image in everyday language), but it can also be used to store arbitrary data.
The advantage of using an image compared to a buffer is that the memory layout is optimized for locality. When reading a specific pixel of an image, reading the nearby pixels is really fast. Most implementations have hardware dedicated to reading from images if you access them through a sampler.
There is a distinction between images and image views. As its name suggests, an image view describes how the GPU must interpret the image.
Transfer and memory operations operate on images themselves, while reading/writing an image operates on image views. You can create multiple image views from the same image.
In the vulkano library, an image is any object that implements the
ImageAccess trait. You
can create a view by wrapping them in an [
ImageAccess trait is low-level, you are encouraged to not implement it yourself but
instead use one of the provided implementations that are specialized depending on the way you
are going to use the image:
AttachmentImagecan be used when you want to draw to an image.
ImmutableImagestores data which never need be changed after the initial upload, like a texture.
To be written.
Low-level implementation of images.
Describes how an aspect of the image that be used to query Vulkan. This is not just a suggestion. Check out VkImageAspectFlagBits in the Vulkan spec.
The set of layouts to use for an image when used in descriptor of various kinds.
Helper type returned from Device’s
Describes how an image is going to be used. This is not just an optimization.
General-purpose image in device memory. Can be used for any usage, but will be slower than a specialized image.
Specifies how the components of an image must be swizzled.
Describes the value that an individual component must return when being accessed.
Helper type for creating extents
The dimensions of an image.
Layout of an image.
Specifies how many mipmaps must be allocated.