pub struct MemoryPropertyFlags(/* private fields */);
Expand description

Properties of a memory type.

Implementations§

source§

impl MemoryPropertyFlags

source

pub const DEVICE_LOCAL: Self = _

The memory is located on the device, and is allocated from a heap that also has the DEVICE_LOCAL flag set.

For some devices, particularly integrated GPUs, the device shares memory with the host and all memory may be device-local, so the distinction is moot. However, if the device has non-device-local memory, it is usually faster for the device to access device-local memory. Therefore, device-local memory is preferred for data that will only be accessed by the device.

If the device and host do not share memory, data transfer between host and device may involve sending the data over the data bus that connects the two. Accesses are faster if they do not have to cross this barrier: device-local memory is fast for the device to access, but slower to access by the host. However, there are devices that share memory with the host, yet have distinct device-local and non-device local memory types. In that case, the speed difference may not be large.

For data transfer between host and device, it is most efficient if the memory is located at the destination of the transfer. Thus, if HOST_VISIBLE versions of both are available, device-local memory is preferred for host-to-device data transfer, while non-device-local memory is preferred for device-to-host data transfer. This is because data is usually written only once but potentially read several times, and because reads can take advantage of caching while writes cannot.

Devices may have memory types that are neither DEVICE_LOCAL nor HOST_VISIBLE. This is regular host memory that is made available to the device exclusively. Although it will be slower to access from the device than DEVICE_LOCAL memory, it can be faster than HOST_VISIBLE memory. It can be used as overflow space if the device is out of memory.

source

pub const HOST_VISIBLE: Self = _

The memory can be mapped into the memory space of the host and accessed as regular RAM.

Memory of this type is required to transfer data between the host and the device. If the memory is going to be accessed by the device more than a few times, it is recommended to copy the data to non-HOST_VISIBLE memory first if it is available.

HOST_VISIBLE memory is always at least either HOST_COHERENT or HOST_CACHED, but it can be both.

source

pub const HOST_COHERENT: Self = _

Host access to the memory does not require calling invalidate_range to make device writes visible to the host, nor flush_range to flush host writes back to the device.

source

pub const HOST_CACHED: Self = _

The memory is cached by the host.

HOST_CACHED memory is fast for reads and random access from the host, so it is preferred for device-to-host data transfer. Memory that is HOST_VISIBLE but not HOST_CACHED is often slow for all accesses other than sequential writing, so it is more suited for host-to-device transfer, and it is often beneficial to write the data in sequence.

source

pub const LAZILY_ALLOCATED: Self = _

Allocations made from the memory are lazy.

This means that no actual allocation is performed. Instead memory is automatically allocated by the Vulkan implementation based on need. You can call DeviceMemory::commitment to query how much memory is currently committed to an allocation.

Memory of this type can only be used on images created with a certain flag, and is never HOST_VISIBLE.

source

pub const PROTECTED: Self = _

The memory can only be accessed by the device, and allows protected queue access.

Memory of this type is never HOST_VISIBLE, HOST_COHERENT or HOST_CACHED.

source

pub const DEVICE_COHERENT: Self = _

Device accesses to the memory are automatically made available and visible to other device accesses.

Memory of this type is slower to access by the device, so it is best avoided for general purpose use. Because of its coherence properties, however, it may be useful for debugging.

source

pub const DEVICE_UNCACHED: Self = _

The memory is not cached on the device.

DEVICE_UNCACHED memory is always also DEVICE_COHERENT.

source

pub const RDMA_CAPABLE: Self = _

Other devices can access the memory via remote direct memory access (RDMA).

source

pub const fn empty() -> Self

Returns a MemoryPropertyFlags with none of the flags set.

source

pub const fn none() -> Self

👎Deprecated since 0.31.0: use empty instead

Returns a MemoryPropertyFlags with none of the flags set.

source

pub const fn count(self) -> u32

Returns the number of flags set in self.

source

pub const fn is_empty(self) -> bool

Returns whether no flags are set in self.

source

pub const fn intersects(self, other: Self) -> bool

Returns whether any flags are set in both self and other.

source

pub const fn contains(self, other: Self) -> bool

Returns whether all flags in other are set in self.

source

pub const fn union(self, other: Self) -> Self

Returns the union of self and other.

source

pub const fn intersection(self, other: Self) -> Self

Returns the intersection of self and other.

source

pub const fn difference(self, other: Self) -> Self

Returns self without the flags set in other.

source

pub const fn symmetric_difference(self, other: Self) -> Self

Returns the flags that are set in self or other, but not in both.

Trait Implementations§

source§

impl BitAnd for MemoryPropertyFlags

§

type Output = MemoryPropertyFlags

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Self) -> Self

Performs the & operation. Read more
source§

impl BitAndAssign for MemoryPropertyFlags

source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
source§

impl BitOr for MemoryPropertyFlags

§

type Output = MemoryPropertyFlags

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> Self

Performs the | operation. Read more
source§

impl BitOrAssign for MemoryPropertyFlags

source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
source§

impl BitXor for MemoryPropertyFlags

§

type Output = MemoryPropertyFlags

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Self) -> Self

Performs the ^ operation. Read more
source§

impl BitXorAssign for MemoryPropertyFlags

source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
source§

impl Clone for MemoryPropertyFlags

source§

fn clone(&self) -> MemoryPropertyFlags

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MemoryPropertyFlags

source§

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

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

impl Default for MemoryPropertyFlags

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<MemoryPropertyFlags> for MemoryPropertyFlags

source§

fn from(val: MemoryPropertyFlags) -> Self

Converts to this type from the input type.
source§

impl From<MemoryPropertyFlags> for MemoryPropertyFlags

source§

fn from(val: MemoryPropertyFlags) -> Self

Converts to this type from the input type.
source§

impl Hash for MemoryPropertyFlags

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 MemoryPropertyFlags

source§

fn eq(&self, other: &MemoryPropertyFlags) -> 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 Sub for MemoryPropertyFlags

§

type Output = MemoryPropertyFlags

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
source§

impl SubAssign for MemoryPropertyFlags

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl Copy for MemoryPropertyFlags

source§

impl Eq for MemoryPropertyFlags

source§

impl StructuralEq for MemoryPropertyFlags

source§

impl StructuralPartialEq for MemoryPropertyFlags

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> 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.