Expand description
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.
Properties of an image
Images and image views
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.
High-level wrappers
In the vulkano library, an image is any object that implements the Image
trait and an image
view is any object that implements the ImageView
trait.
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:
- An
AttachmentImage
can be used when you want to draw to an image. - An
ImmutableImage
stores data which never need be changed after the initial upload, like a texture.
Low-level information
To be written.
Re-exports
pub use self::attachment::AttachmentImage;
pub use self::immutable::ImmutableImage;
pub use self::swapchain::SwapchainImage;
pub use self::sys::ImageCreationError;
pub use self::traits::ImageAccess;
pub use self::traits::ImageInner;
pub use self::traits::ImageViewAccess;