[−][src]Struct vulkano::image::attachment::AttachmentImage
ImageAccess whose purpose is to be used as a framebuffer attachment.
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. Transient image are only
relevant for images that serve as attachments, so AttachmentImage
is the only type of
image in vulkano that provides a shortcut for this.
A transient image is a special kind of image whose content is undefined outside of render passes. Once you finish drawing, reading from it will returned undefined data (which can be either valid or garbage, depending on the implementation).
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 as it may improve performance.
Methods
impl<F> AttachmentImage<F>
[src]
pub fn new(
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Creates a new image with the given dimensions and format.
Returns an error if the dimensions are too large or if the backend doesn't support this format as a framebuffer attachment.
pub fn input_attachment(
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as new
, but creates an image that can be used as an input attachment.
Note: This function is just a convenient shortcut for
with_usage
.
pub fn multisampled(
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as new
, but creates a multisampled image.
Note: You can also use this function and pass
1
for the number of samples if you want a regular image.
pub fn multisampled_input_attachment(
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as multisampled
, but creates an image that can be used as an input attachment.
Note: This function is just a convenient shortcut for
multisampled_with_usage
.
pub fn with_usage(
device: Arc<Device>,
dimensions: [u32; 2],
format: F,
usage: ImageUsage
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
format: F,
usage: ImageUsage
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as new
, but lets you specify additional usages.
The color_attachment
or depth_stencil_attachment
usages are automatically added based
on the format of the usage. Therefore the usage
parameter allows you specify usages in
addition to these two.
pub fn multisampled_with_usage(
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F,
usage: ImageUsage
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F,
usage: ImageUsage
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as with_usage
, but creates a multisampled image.
Note: You can also use this function and pass
1
for the number of samples if you want a regular image.
Note: This function is just a convenient shortcut for
multisampled_with_usage
.
pub fn sampled(
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as new
, except that the image can later be sampled.
Note: This function is just a convenient shortcut for
with_usage
.
pub fn sampled_input_attachment(
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as sampled
, except that the image can be used as an input attachment.
Note: This function is just a convenient shortcut for
with_usage
.
pub fn sampled_multisampled(
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as sampled
, but creates a multisampled image.
Note: You can also use this function and pass
1
for the number of samples if you want a regular image.
Note: This function is just a convenient shortcut for
multisampled_with_usage
.
pub fn sampled_multisampled_input_attachment(
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as sampled_multisampled
, but creates an image that can be used as an input
attachment.
Note: This function is just a convenient shortcut for
multisampled_with_usage
.
pub fn transient(
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as new
, except that the image will be transient.
A transient image is special because its content is undefined outside of a render pass. This means that the implementation has the possibility to not allocate any memory for it.
Note: This function is just a convenient shortcut for
with_usage
.
pub fn transient_input_attachment(
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as transient
, except that the image can be used as an input attachment.
Note: This function is just a convenient shortcut for
with_usage
.
pub fn transient_multisampled(
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as transient
, but creates a multisampled image.
Note: You can also use this function and pass
1
for the number of samples if you want a regular image.
Note: This function is just a convenient shortcut for
multisampled_with_usage
.
pub fn transient_multisampled_input_attachment(
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
[src]
device: Arc<Device>,
dimensions: [u32; 2],
samples: u32,
format: F
) -> Result<Arc<AttachmentImage<F>>, ImageCreationError> where
F: FormatDesc,
Same as transient_multisampled
, but creates an image that can be used as an input
attachment.
Note: This function is just a convenient shortcut for
multisampled_with_usage
.
impl<F, A> AttachmentImage<F, A>
[src]
pub fn dimensions(&self) -> [u32; 2]
[src]
Returns the dimensions of the image.
Trait Implementations
impl<F, A> ImageAccess for AttachmentImage<F, A> where
F: 'static + Send + Sync,
[src]
F: 'static + Send + Sync,
fn inner(&self) -> ImageInner
[src]
fn initial_layout_requirement(&self) -> ImageLayout
[src]
fn final_layout_requirement(&self) -> ImageLayout
[src]
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool
[src]
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool
[src]
fn conflict_key(&self) -> u64
[src]
fn try_gpu_lock(
&self,
_: bool,
expected_layout: ImageLayout
) -> Result<(), AccessError>
[src]
&self,
_: bool,
expected_layout: ImageLayout
) -> Result<(), AccessError>
unsafe fn increase_gpu_lock(&self)
[src]
unsafe fn unlock(&self, new_layout: Option<ImageLayout>)
[src]
unsafe fn layout_initialized(&self)
[src]
fn is_layout_initialized(&self) -> bool
[src]
fn format(&self) -> Format
[src]
fn has_color(&self) -> bool
[src]
fn has_depth(&self) -> bool
[src]
fn has_stencil(&self) -> bool
[src]
fn mipmap_levels(&self) -> u32
[src]
fn samples(&self) -> u32
[src]
fn dimensions(&self) -> ImageDimensions
[src]
fn supports_blit_source(&self) -> bool
[src]
fn supports_blit_destination(&self) -> bool
[src]
unsafe fn preinitialized_layout(&self) -> bool
[src]
unsafe fn forced_undefined_initial_layout(
self,
preinitialized: bool
) -> ImageAccessFromUndefinedLayout<Self> where
Self: Sized,
[src]
self,
preinitialized: bool
) -> ImageAccessFromUndefinedLayout<Self> where
Self: Sized,
impl<F, A> ImageViewAccess for AttachmentImage<F, A> where
F: 'static + Send + Sync,
[src]
F: 'static + Send + Sync,
fn parent(&self) -> &dyn ImageAccess
[src]
fn dimensions(&self) -> Dimensions
[src]
fn inner(&self) -> &UnsafeImageView
[src]
fn descriptor_set_storage_image_layout(&self) -> ImageLayout
[src]
fn descriptor_set_combined_image_sampler_layout(&self) -> ImageLayout
[src]
fn descriptor_set_sampled_image_layout(&self) -> ImageLayout
[src]
fn descriptor_set_input_attachment_layout(&self) -> ImageLayout
[src]
fn identity_swizzle(&self) -> bool
[src]
fn format(&self) -> Format
[src]
fn samples(&self) -> u32
[src]
fn can_be_sampled(&self, _sampler: &Sampler) -> bool
[src]
impl<F: Debug, A: Debug> Debug for AttachmentImage<F, A>
[src]
Auto Trait Implementations
impl<F, A> Send for AttachmentImage<F, A> where
A: Send,
F: Send,
A: Send,
F: Send,
impl<F, A> Unpin for AttachmentImage<F, A> where
A: Unpin,
F: Unpin,
A: Unpin,
F: Unpin,
impl<F, A> Sync for AttachmentImage<F, A> where
A: Sync,
F: Sync,
A: Sync,
F: Sync,
impl<F, A> UnwindSafe for AttachmentImage<F, A> where
A: UnwindSafe,
F: UnwindSafe,
A: UnwindSafe,
F: UnwindSafe,
impl<F, A> RefUnwindSafe for AttachmentImage<F, A> where
A: RefUnwindSafe,
F: RefUnwindSafe,
A: RefUnwindSafe,
F: RefUnwindSafe,
Blanket Implementations
impl<T> ImageAccess for T where
T: SafeDeref,
<T as Deref>::Target: ImageAccess,
[src]
T: SafeDeref,
<T as Deref>::Target: ImageAccess,
fn inner(&Self) -> ImageInner
[src]
fn initial_layout_requirement(&Self) -> ImageLayout
[src]
fn final_layout_requirement(&Self) -> ImageLayout
[src]
fn conflicts_buffer(&Self, &dyn BufferAccess) -> bool
[src]
fn conflicts_image(&Self, &dyn ImageAccess) -> bool
[src]
fn conflict_key(&Self) -> u64
[src]
fn try_gpu_lock(&Self, bool, ImageLayout) -> Result<(), AccessError>
[src]
unsafe fn increase_gpu_lock(&Self)
[src]
unsafe fn unlock(&Self, Option<ImageLayout>)
[src]
unsafe fn layout_initialized(&Self)
[src]
fn is_layout_initialized(&Self) -> bool
[src]
fn format(&self) -> Format
[src]
fn has_color(&self) -> bool
[src]
fn has_depth(&self) -> bool
[src]
fn has_stencil(&self) -> bool
[src]
fn mipmap_levels(&self) -> u32
[src]
fn samples(&self) -> u32
[src]
fn dimensions(&self) -> ImageDimensions
[src]
fn supports_blit_source(&self) -> bool
[src]
fn supports_blit_destination(&self) -> bool
[src]
unsafe fn preinitialized_layout(&self) -> bool
[src]
unsafe fn forced_undefined_initial_layout(
self,
preinitialized: bool
) -> ImageAccessFromUndefinedLayout<Self> where
Self: Sized,
[src]
self,
preinitialized: bool
) -> ImageAccessFromUndefinedLayout<Self> where
Self: Sized,
impl<T> ImageViewAccess for T where
T: SafeDeref,
<T as Deref>::Target: ImageViewAccess,
[src]
T: SafeDeref,
<T as Deref>::Target: ImageViewAccess,
fn parent(&Self) -> &dyn ImageAccess
[src]
fn inner(&Self) -> &UnsafeImageView
[src]
fn dimensions(&Self) -> Dimensions
[src]
fn descriptor_set_storage_image_layout(&Self) -> ImageLayout
[src]
fn descriptor_set_combined_image_sampler_layout(&Self) -> ImageLayout
[src]
fn descriptor_set_sampled_image_layout(&Self) -> ImageLayout
[src]
fn descriptor_set_input_attachment_layout(&Self) -> ImageLayout
[src]
fn identity_swizzle(&Self) -> bool
[src]
fn can_be_sampled(&Self, &Sampler) -> bool
[src]
fn format(&self) -> Format
[src]
fn samples(&self) -> u32
[src]
impl<T> Content for T
[src]
fn ref_from_ptr(*mut c_void, usize) -> Option<*mut T>
[src]
fn is_size_suitable(usize) -> bool
[src]
fn indiv_size() -> usize
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,