Image storage (1D, 2D, 3D, arrays, etc.).
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
Image trait and an image
view is any object that implements the
Since these traits are low-level, you are encouraged to not implement them 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 and images views.
Describes how an image is going to be used. This is not 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.
Layout of an image.
Specifies how many mipmaps must be allocated.