Struct vulkano::image::attachment::AttachmentImage[][src]

pub struct AttachmentImage<A = PotentialDedicatedAllocation<StdMemoryPoolAlloc>> { /* fields omitted */ }

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.

Implementations

impl AttachmentImage[src]

pub fn new(
    device: Arc<Device>,
    dimensions: [u32; 2],
    format: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format,
    usage: ImageUsage
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format,
    usage: ImageUsage
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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: Format
) -> Result<Arc<AttachmentImage>, ImageCreationError>
[src]

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<A> AttachmentImage<A>[src]

pub fn dimensions(&self) -> [u32; 2][src]

Returns the dimensions of the image.

Trait Implementations

impl<A: Debug> Debug for AttachmentImage<A>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<A> Hash for AttachmentImage<A>[src]

fn hash<H: Hasher>(&self, state: &mut H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl<A> ImageAccess for AttachmentImage<A>[src]

fn inner(&self) -> ImageInner<'_>[src]

Returns the inner unsafe image object used by this image.

fn initial_layout_requirement(&self) -> ImageLayout[src]

Returns the layout that the image has when it is first used in a primary command buffer. Read more

fn final_layout_requirement(&self) -> ImageLayout[src]

Returns the layout that the image must be returned to before the end of the command buffer. Read more

fn descriptor_layouts(&self) -> Option<ImageDescriptorLayouts>[src]

Returns an ImageDescriptorLayouts structure specifying the image layout to use in descriptors of various kinds. Read more

fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool[src]

Returns true if an access to self potentially overlaps the same memory as an access to other. Read more

fn conflicts_image(&self, other: &dyn ImageAccess) -> bool[src]

Returns true if an access to self potentially overlaps the same memory as an access to other. Read more

fn conflict_key(&self) -> u64[src]

Returns a key that uniquely identifies the memory content of the image. Two ranges that potentially overlap in memory must return the same key. Read more

fn try_gpu_lock(
    &self,
    _: bool,
    expected_layout: ImageLayout
) -> Result<(), AccessError>
[src]

Locks the resource for usage on the GPU. Returns an error if the lock can’t be acquired. Read more

unsafe fn increase_gpu_lock(&self)[src]

Locks the resource for usage on the GPU. Supposes that the resource is already locked, and simply increases the lock by one. Read more

unsafe fn unlock(&self, new_layout: Option<ImageLayout>)[src]

Unlocks the resource previously acquired with try_gpu_lock or increase_gpu_lock. Read more

unsafe fn layout_initialized(&self)[src]

When images are created their memory layout is initially Undefined or Preinitialized. This method allows the image memory barrier creation process to signal when an image has been transitioned out of its initial Undefined or Preinitialized state. This allows vulkano to avoid creating unnecessary image memory barriers between future uses of the image. Read more

fn is_layout_initialized(&self) -> bool[src]

fn current_miplevels_access(&self) -> Range<u32>[src]

Returns the current mip level that is accessed by the gpu

fn current_layer_levels_access(&self) -> Range<u32>[src]

Returns the current layer level that is accessed by the gpu

fn format(&self) -> Format[src]

Returns the format of this image.

fn has_color(&self) -> bool[src]

Returns true if the image is a color image.

fn has_depth(&self) -> bool[src]

Returns true if the image has a depth component. In other words, if it is a depth or a depth-stencil format. Read more

fn has_stencil(&self) -> bool[src]

Returns true if the image has a stencil component. In other words, if it is a stencil or a depth-stencil format. Read more

fn mipmap_levels(&self) -> u32[src]

Returns the number of mipmap levels of this image.

fn samples(&self) -> u32[src]

Returns the number of samples of this image.

fn dimensions(&self) -> ImageDimensions[src]

Returns the dimensions of the image.

fn supports_blit_source(&self) -> bool[src]

Returns true if the image can be used as a source for blits.

fn supports_blit_destination(&self) -> bool[src]

Returns true if the image can be used as a destination for blits.

unsafe fn preinitialized_layout(&self) -> bool[src]

unsafe fn forced_undefined_initial_layout(
    self,
    preinitialized: bool
) -> ImageAccessFromUndefinedLayout<Self> where
    Self: Sized
[src]

Wraps around this ImageAccess and returns an identical ImageAccess but whose initial layout requirement is either Undefined or Preinitialized. Read more

impl<A> PartialEq<AttachmentImage<A>> for AttachmentImage<A>[src]

fn eq(&self, other: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<A> Eq for AttachmentImage<A>[src]

Auto Trait Implementations

impl<A> RefUnwindSafe for AttachmentImage<A> where
    A: RefUnwindSafe

impl<A> Send for AttachmentImage<A> where
    A: Send

impl<A> Sync for AttachmentImage<A> where
    A: Sync

impl<A> Unpin for AttachmentImage<A> where
    A: Unpin

impl<A> UnwindSafe for AttachmentImage<A> where
    A: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Content for T[src]

pub fn ref_from_ptr(*mut c_void, usize) -> Option<*mut T>[src]

Builds a pointer to this type from a raw pointer.

pub fn is_size_suitable(usize) -> bool[src]

Returns true if the size is suitable to store a type like this.

pub fn indiv_size() -> usize[src]

Returns the size of an individual element.

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.