Module vulkano::image::attachment
[−]
[src]
Image whose purpose is to be used as a framebuffer attachment.
This module declares the AttachmentImage
type. It is a safe wrapper around UnsafeImage
and implements all the relevant image traits.
The image is always two-dimensional and has only one mipmap, but it can have any kind of
format. Trying to use a format that the backend doesn't support for rendering will result in
an error being returned when creating the image. Once you have an AttachmentImage
, you are
guaranteed that you will be able to draw on it.
The template parameter of AttachmentImage
is a type that describes the format of the image.
Regular vs transient
Calling AttachmentImage::new
will create a regular image, while calling
AttachmentImage::transient
will create a transient image.
A transient image is a special kind of image whose content is undefined outside of render passes. Once you finish drawing, you can't read from it anymore.
This gives a hint to the Vulkan implementation that it is possible for the image's content to live exclusively in some cache memory, and that no real memory has to be allocated for it.
In other words, if you are going to read from the image after drawing to it, use a regular image. If you don't need to read from it (for example if it's some kind of intermediary color, or a depth buffer that is only used once) then use a transient image.
Structs
AttachmentImage |
Image whose purpose is to be used as a framebuffer attachment. |