Image

Struct Image 

Source
pub struct Image<A: Allocator = DefaultAllocator> { /* private fields */ }
Expand description

Abstraction over a VkImage. Stores information about size, format, etc. Additionally couples the image data together with a memory allocation.

Implementations§

Source§

impl<A: Allocator> Image<A>

Source

pub fn new( device: Device, alloc: &mut A, width: u32, height: u32, usage: ImageUsageFlags, format: Format, samples: SampleCountFlags, ) -> Result<Self>

Create a new simple [VkImage] and allocate some memory to it.

Source

pub fn view(&self, aspect: ImageAspectFlags) -> Result<ImageView>

Construct a trivial ImageView from this Image. This is an image view that views the entire image subresource.

§Lifetime

The returned ImageView is valid as long as self is valid.

Source

pub fn is_owned(&self) -> bool

Whether this image resource is owned by the application or an external manager (such as the swapchain).

Source

pub unsafe fn handle(&self) -> Image

Get unsafe access to the underlying VkImage handle.

§Safety

Any vulkan calls that mutate this image’s state may put the system into an undefined state.

Source

pub fn format(&self) -> Format

Get the image format

Source

pub fn size(&self) -> Extent3D

Get the image size

Source

pub fn width(&self) -> u32

Get the image width

Source

pub fn height(&self) -> u32

Get the image height

Source

pub fn depth(&self) -> u32

Get the image depth (for 2D images, this is 1)

Source

pub fn layers(&self) -> u32

Get the number of layers in the image

Source

pub fn mip_levels(&self) -> u32

Get the number of mip levels in the image

Source

pub fn samples(&self) -> SampleCountFlags

Get the number of MSAA samples for this image.

Trait Implementations§

Source§

impl AsRaw for Image

Source§

unsafe fn as_raw(&self) -> u64

Get the as_raw u64 value of the handle underlying the object
Source§

impl<A: Allocator> Debug for Image<A>

Source§

fn fmt(&self, __f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: Allocator> Drop for Image<A>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Nameable for Image

Source§

const OBJECT_TYPE: ObjectType = vk::ObjectType::IMAGE

Change the name of the given object
Source§

impl<A: Allocator> Send for Image<A>

Source§

impl<A: Allocator> Sync for Image<A>

Auto Trait Implementations§

§

impl<A> Freeze for Image<A>
where <A as Allocator>::Allocation: Freeze,

§

impl<A> RefUnwindSafe for Image<A>

§

impl<A> Unpin for Image<A>
where <A as Allocator>::Allocation: Unpin,

§

impl<A> UnwindSafe for Image<A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.