logo
pub struct UnsafeImage { /* private fields */ }
Expand description

A storage for pixels or arbitrary data.

Safety

UnsafeImage is not unsafe to create, but it is unsafe to use:

  • You must manually bind memory to the image with bind_memory. The memory must respect the requirements returned by memory_requirements.
  • The memory that you bind to the image must be manually kept alive.
  • The queue family ownership must be manually enforced.
  • The usage must be manually enforced.
  • The image layout must be manually enforced and transitioned.

Implementations

Creates a new UnsafeImage.

Panics
  • Panics if one of the values in create_info.dimensions is zero.
  • Panics if create_info.format is None.
  • Panics if create_info.block_texel_view_compatible is set but not create_info.mutable_format.
  • Panics if create_info.mip_levels is 0.
  • Panics if create_info.sharing is Sharing::Concurrent with less than 2 items.
  • Panics if create_info.initial)layout is something other than ImageLayout::Undefined or ImageLayout::Preinitialized.
  • Panics if create_info.usage is empty.
  • Panics if create_info.usage contains transient_attachment, but does not also contain at least one of color_attachment, depth_stencil_attachment, input_attachment, or if it contains values other than these.

Returns the memory requirements for this image.

Returns the dimensions of the image.

Returns the image’s format.

Returns the features supported by the image’s format.

Returns the number of mipmap levels in the image.

Returns the initial layout of the image.

Returns the number of samples for the image.

Returns the tiling of the image.

Returns the usage the image was created with.

Returns whether mutable_format is enabled on the image.

Returns whether cube_compatible is enabled on the image.

Returns whether array_2d_compatible is enabled on the image.

Returns whether block_texel_view_compatible is enabled on the image.

Returns a key unique to each UnsafeImage. Can be used for the conflicts_key method.

Queries the layout of an image in memory. Only valid for images with linear tiling.

This function is only valid for images with a color format. See the other similar functions for the other aspects.

The layout is invariant for each image. However it is not cached, as this would waste memory in the case of non-linear-tiling images. You are encouraged to store the layout somewhere in order to avoid calling this semi-expensive function at every single memory access.

Note that while Vulkan allows querying the array layers other than 0, it is redundant as you can easily calculate the position of any layer.

Panic
  • Panics if the mipmap level is out of range.
Safety
  • The image must not have a depth, stencil or depth-stencil format.
  • The image must have been created with linear tiling.

Same as color_linear_layout, except that it retrieves the depth component of the image.

Panic
  • Panics if the mipmap level is out of range.
Safety
  • The image must have a depth or depth-stencil format.
  • The image must have been created with linear tiling.

Same as color_linear_layout, except that it retrieves the stencil component of the image.

Panic
  • Panics if the mipmap level is out of range.
Safety
  • The image must have a stencil or depth-stencil format.
  • The image must have been created with linear tiling.

Same as color_linear_layout, except that it retrieves layout for the requested YCbCr component too if the format is a YCbCr format.

Panic
  • Panics if plane aspect is out of range.
  • Panics if the aspect is not a color or planar aspect.
  • Panics if the number of mipmaps is not 1.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the device that owns Self.

Executes the destructor for this type. Read more

Feeds this value into the given Hasher. Read more

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

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

This method tests for !=.

The type of the object.

Returns a reference to the object.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.