Struct vulkano::image::attachment::AttachmentImage
[−]
[src]
pub struct AttachmentImage<F, A = Arc<StdMemoryPool>> where A: MemoryPool { /* fields omitted */ }
Image 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 performances.
Methods
impl<F> AttachmentImage<F>
[src]
fn new(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.
fn transient(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.
impl<F, A> AttachmentImage<F, A> where A: MemoryPool
[src]
fn dimensions(&self) -> [u32; 2]
Returns the dimensions of the image.
Trait Implementations
impl<F: Debug, A: Debug> Debug for AttachmentImage<F, A> where A: MemoryPool, A::Alloc: Debug
[src]
impl<F, A> Image for AttachmentImage<F, A> where F: 'static + Send + Sync, A: MemoryPool
[src]
fn inner(&self) -> &UnsafeImage
Returns the inner unsafe image object used by this image.
fn blocks(&self, _: Range<u32>, _: Range<u32>) -> Vec<(u32, u32)>
Given a range, returns the list of blocks which each range is contained in. Read more
fn block_mipmap_levels_range(&self, block: (u32, u32)) -> Range<u32>
fn block_array_layers_range(&self, block: (u32, u32)) -> Range<u32>
fn initial_layout(&self, _: (u32, u32), _: Layout) -> (Layout, bool, bool)
Called when a command buffer that uses this image is being built. Given a block, this function should return the layout that the block will have when the command buffer is submitted. Read more
fn final_layout(&self, _: (u32, u32), _: Layout) -> (Layout, bool, bool)
Called when a command buffer that uses this image is being built. Given a block, this function should return the layout that the block must have when the command buffer is end. Read more
fn needs_fence(&self, access: &mut Iterator<Item=AccessRange>) -> Option<bool>
Returns whether accessing a subresource of that image should signal a fence.
unsafe fn gpu_access(&self, _: &mut Iterator<Item=AccessRange>, submission: &Arc<Submission>) -> GpuAccessResult
fn format(&self) -> Format
Returns the format of this image.
fn samples(&self) -> u32
Returns the number of samples of this image.
fn dimensions(&self) -> ImageDimensions
Returns the dimensions of the image.
fn supports_blit_source(&self) -> bool
Returns true if the image can be used as a source for blits.
fn supports_blit_destination(&self) -> bool
Returns true if the image can be used as a destination for blits.
impl<F, A> ImageClearValue<F::ClearValue> for AttachmentImage<F, A> where F: FormatDesc + 'static + Send + Sync, A: MemoryPool
[src]
fn decode(&self, value: F::ClearValue) -> Option<ClearValue>
impl<P, F, A> ImageContent<P> for AttachmentImage<F, A> where F: 'static + Send + Sync, A: MemoryPool
[src]
fn matches_format(&self) -> bool
Checks whether pixels of type P
match the format of the image.
impl<F, A> ImageView for AttachmentImage<F, A> where F: 'static + Send + Sync, A: MemoryPool
[src]
fn parent(&self) -> &Image
fn parent_arc(me: &Arc<Self>) -> Arc<Image> where Self: Sized
fn dimensions(&self) -> Dimensions
Returns the dimensions of the image view.
fn blocks(&self) -> Vec<(u32, u32)>
Returns the blocks of the parent image this image view overlaps.
fn inner(&self) -> &UnsafeImageView
Returns the inner unsafe image view object used by this image view.
fn descriptor_set_storage_image_layout(&self) -> Layout
Returns the image layout to use in a descriptor with the given subresource.
fn descriptor_set_combined_image_sampler_layout(&self) -> Layout
Returns the image layout to use in a descriptor with the given subresource.
fn descriptor_set_sampled_image_layout(&self) -> Layout
Returns the image layout to use in a descriptor with the given subresource.
fn descriptor_set_input_attachment_layout(&self) -> Layout
Returns the image layout to use in a descriptor with the given subresource.
fn identity_swizzle(&self) -> bool
Returns true if the view doesn't use components swizzling. Read more
fn format(&self) -> Format
Returns the format of this view. This can be different from the parent's format.
fn samples(&self) -> u32
fn can_be_sampled(&self, sampler: &Sampler) -> bool
Returns true if the given sampler can be used with this image view. Read more