logo
Expand description

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.

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 ImageAccess trait. You can create a view by wrapping them in an ImageView.

Since the 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:

  • 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::view::ImageViewAbstract;
pub use self::view::ImageViewType;

Modules

Low-level implementation of images.
Image views.

Structs

A mask specifying one or more ImageAspects.
Flags that can be set when creating a new image.
The set of layouts to use for an image when used in descriptor of various kinds.
The image configuration to query in PhysicalDevice::image_format_properties.
The properties that are supported by a physical device for images of a certain type.
One or more subresources of an image, spanning a single mip level, that should be accessed by a command.
One or more subresources of an image that should be accessed by a command.
Describes how an image is going to be used. This is not just an optimization.
Specifies a set of SampleCount values.
Flags specifying information about a sparse resource.
The properties that are supported by a physical device for sparse images of a certain type.
Requirements for binding memory to a sparse image.
General-purpose image in device memory. Can be used for any usage, but will be slower than a specialized image.
Describes the memory layout of an image.

Enums

An individual data type within an image.
The dimensions of an image.
In-memory layout of the pixel data of an image.
Specifies how many mipmaps must be allocated.