logo
pub struct AttachmentImage<A = PotentialDedicatedAllocation<StdMemoryPoolAlloc>> { /* private fields */ }
Expand description

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

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.

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.

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.

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.

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.

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.

Same as multisampled_with_usage, but creates an image with multiple layers.

Note: You can also use this function and pass 1 for the number of layers if you want a regular image.

Same as new, except that the image can later be sampled.

Note: This function is just a convenient shortcut for with_usage.

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.

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.

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.

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.

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.

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.

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.

Exports posix file descriptor for the allocated memory requires khr_external_memory_fd and khr_external_memory extensions to be loaded. Only works on Linux.

Return the size of the allocated memory (used for e.g. with cuda)

Trait Implementations

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

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

Returns the inner unsafe image object used by this image.

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

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

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

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

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

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

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

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

Returns the current mip level that is accessed by the gpu

Returns the current array layer that is accessed by the gpu

Returns the format of this image.

Returns the number of mipmap levels of this image.

Returns the number of samples of this image.

Returns the dimensions of the image.

Returns the features supported by the image’s format.

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

Checks whether pixels of type P match the format of the image.

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Builds a pointer to this type from a raw pointer.

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

Returns the size of an individual element.

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.