Struct vulkano::image::sys::RawImage

source ·
pub struct RawImage { /* private fields */ }
Expand description

A raw image, with no memory backing it.

This is the basic image type, a direct translation of a VkImage object, but it is mostly useless in this form. After creating a raw image, you must call bind_memory to make a complete image object.

See also the parent module-level documentation for more information about images.

Implementations§

source§

impl RawImage

source

pub fn new( device: Arc<Device>, create_info: ImageCreateInfo ) -> Result<RawImage, Validated<VulkanError>>

Creates a new RawImage.

source

pub unsafe fn from_handle( device: Arc<Device>, handle: Image, create_info: ImageCreateInfo ) -> Result<Self, VulkanError>

Creates a new RawImage from a raw object handle.

Safety
  • handle must be a valid Vulkan object handle created from device.
  • handle must refer to an image that has not yet had memory bound to it.
  • create_info must match the info used to create the object.
source

pub fn bind_memory( self, allocations: impl IntoIterator<Item = ResourceMemory> ) -> Result<Image, (Validated<VulkanError>, RawImage, impl ExactSizeIterator<Item = ResourceMemory>)>

Binds device memory to this image.

  • If self.flags() does not contain ImageCreateFlags::DISJOINT, then allocations must contain exactly one element.
  • If self.flags() contains ImageCreateFlags::DISJOINT, and self.tiling() is ImageTiling::Linear or ImageTiling::Optimal, then allocations must contain exactly self.format().unwrap().planes().len() elements.
  • If self.flags() contains ImageCreateFlags::DISJOINT, and self.tiling() is ImageTiling::DrmFormatModifier, then allocations must contain exactly self.drm_format_modifier().unwrap().1 elements.
source

pub fn memory_requirements(&self) -> &[MemoryRequirements]

Returns the memory requirements for this image.

  • If the image is a swapchain image, this returns a slice with a length of 0.
  • If self.flags().disjoint is not set, this returns a slice with a length of 1.
  • If self.flags().disjoint is set, this returns a slice with a length equal to self.format().unwrap().planes().len().
source

pub fn flags(&self) -> ImageCreateFlags

Returns the flags the image was created with.

source

pub fn image_type(&self) -> ImageType

Returns the image type of the image.

source

pub fn format(&self) -> Format

Returns the image’s format.

source

pub fn format_features(&self) -> FormatFeatures

Returns the features supported by the image’s format.

source

pub fn view_formats(&self) -> &[Format]

Returns the formats that an image view created from this image can have.

source

pub fn extent(&self) -> [u32; 3]

Returns the extent of the image.

source

pub fn array_layers(&self) -> u32

Returns the number of array layers in the image.

source

pub fn mip_levels(&self) -> u32

Returns the number of mip levels in the image.

source

pub fn initial_layout(&self) -> ImageLayout

Returns the initial layout of the image.

source

pub fn samples(&self) -> SampleCount

Returns the number of samples for the image.

source

pub fn tiling(&self) -> ImageTiling

Returns the tiling of the image.

source

pub fn usage(&self) -> ImageUsage

Returns the usage the image was created with.

source

pub fn stencil_usage(&self) -> Option<ImageUsage>

Returns the stencil usage the image was created with.

source

pub fn sharing(&self) -> &Sharing<SmallVec<[u32; 4]>>

Returns the sharing the image was created with.

source

pub fn drm_format_modifier(&self) -> Option<(u64, u32)>

If self.tiling() is ImageTiling::DrmFormatModifier, returns the DRM format modifier of the image, and the number of memory planes. This was either provided in ImageCreateInfo::drm_format_modifiers, or if multiple modifiers were provided, selected from the list by the Vulkan implementation.

source

pub fn external_memory_handle_types(&self) -> ExternalMemoryHandleTypes

Returns the external memory handle types that are supported with this image.

source

pub fn subresource_layers(&self) -> ImageSubresourceLayers

Returns an ImageSubresourceLayers covering the first mip level of the image. All aspects of the image are selected, or plane0 if the image is multi-planar.

source

pub fn subresource_range(&self) -> ImageSubresourceRange

Returns an ImageSubresourceRange covering the whole image. If the image is multi-planar, only the color aspect is selected.

source

pub fn subresource_layout( &self, aspect: ImageAspect, mip_level: u32, array_layer: u32 ) -> Result<SubresourceLayout, Box<ValidationError>>

Queries the memory layout of a single subresource of the image.

Only images with linear tiling are supported, if they do not have a format with both a depth and a stencil format. Images with optimal tiling have an opaque image layout that is not suitable for direct memory accesses, and likewise for combined depth/stencil formats. Multi-planar formats are supported, but you must specify one of the planes as the aspect, not ImageAspect::Color.

The results of this function are cached, so that future calls with the same arguments do not need to make a call to the Vulkan API again.

Trait Implementations§

source§

impl Debug for RawImage

source§

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

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

impl DeviceOwned for RawImage

source§

fn device(&self) -> &Arc<Device>

Returns the device that owns self.
source§

impl Drop for RawImage

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Hash for RawImage

source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · source§

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

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

impl PartialEq for RawImage

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl VulkanObject for RawImage

§

type Handle = Image

The type of the object.
source§

fn handle(&self) -> Self::Handle

Returns the raw Vulkan handle of the object.
source§

impl Eq for RawImage

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> DeviceOwnedVulkanObject for Twhere T: DeviceOwned + VulkanObject,

source§

fn set_debug_utils_object_name( &self, object_name: Option<&str> ) -> Result<(), VulkanError>

Assigns a human-readable name to the object for debugging purposes. 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.