pub struct AllocationCreateFlags { /* private fields */ }Expand description
Flags for configuring Allocation construction.
Implementations§
Source§impl AllocationCreateFlags
impl AllocationCreateFlags
Sourcepub const DEDICATED_MEMORY: Self
pub const DEDICATED_MEMORY: Self
Set this flag if the allocation should have its own memory block.
Use it for special, big resources, like fullscreen images used as attachments.
You should not use this flag if AllocationCreateInfo::pool is not None.
Sourcepub const NEVER_ALLOCATE: Self
pub const NEVER_ALLOCATE: Self
Set this flag to only try to allocate from existing erupt::vk::DeviceMemory blocks and never create new such block.
If new allocation cannot be placed in any of the existing blocks, allocation
fails with erupt::vk::Result::ERROR_OUT_OF_DEVICE_MEMORY error.
You should not use AllocationCreateFlags::DEDICATED_MEMORY and AllocationCreateFlags::NEVER_ALLOCATE at the same time. It makes no sense.
If AllocationCreateInfo::pool is not None, this flag is implied and ignored.
Sourcepub const MAPPED: Self
pub const MAPPED: Self
Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.
Pointer to mapped memory will be returned through Allocation::get_mapped_data().
Is it valid to use this flag for allocation made from memory type that is not
erupt::vk::MemoryPropertyFlags::HOST_VISIBLE. This flag is then ignored and memory is not mapped. This is
useful if you need an allocation that is efficient to use on GPU
(erupt::vk::MemoryPropertyFlags::DEVICE_LOCAL) and still want to map it directly if possible on platforms that
support it (e.g. Intel GPU).
You should not use this flag together with AllocationCreateFlags::CAN_BECOME_LOST.
Sourcepub const CAN_BECOME_LOST: Self
pub const CAN_BECOME_LOST: Self
Allocation created with this flag can become lost as a result of another
allocation with AllocationCreateFlags::CAN_MAKE_OTHER_LOST flag, so you must check it before use.
To check if allocation is not lost, call Allocator::get_allocation_info and check if
AllocationInfo::device_memory is not null.
You should not use this flag together with AllocationCreateFlags::MAPPED.
Sourcepub const CAN_MAKE_OTHER_LOST: Self
pub const CAN_MAKE_OTHER_LOST: Self
While creating allocation using this flag, other allocations that were
created with flag AllocationCreateFlags::CAN_BECOME_LOST can become lost.
Sourcepub const USER_DATA_COPY_STRING: Self
pub const USER_DATA_COPY_STRING: Self
Set this flag to treat AllocationCreateInfo::user_data as pointer to a
null-terminated string. Instead of copying pointer value, a local copy of the
string is made and stored in allocation’s user data. The string is automatically
freed together with the allocation. It is also used in Allocator::build_stats_string.
Sourcepub const UPPER_ADDRESS: Self
pub const UPPER_ADDRESS: Self
Allocation will be created from upper stack in a double stack pool.
This flag is only allowed for custom pools created with AllocatorPoolCreateFlags::LINEAR_ALGORITHM flag.
Sourcepub const CREATE_DONT_BIND: Self
pub const CREATE_DONT_BIND: Self
Create both buffer/image and allocation, but don’t bind them together.
It is useful when you want to bind yourself to do some more advanced binding, e.g. using some extensions.
The flag is meaningful only with functions that bind by default, such as Allocator::create_buffer
or Allocator::create_image. Otherwise it is ignored.
Sourcepub const STRATEGY_BEST_FIT: Self
pub const STRATEGY_BEST_FIT: Self
Allocation strategy that chooses smallest possible free range for the allocation.
Sourcepub const STRATEGY_WORST_FIT: Self
pub const STRATEGY_WORST_FIT: Self
Allocation strategy that chooses biggest possible free range for the allocation.
Sourcepub const STRATEGY_FIRST_FIT: Self
pub const STRATEGY_FIRST_FIT: Self
Allocation strategy that chooses first suitable free range for the allocation.
“First” doesn’t necessarily means the one with smallest offset in memory, but rather the one that is easiest and fastest to find.
Sourcepub const STRATEGY_MIN_MEMORY: Self
pub const STRATEGY_MIN_MEMORY: Self
Allocation strategy that tries to minimize memory usage.
Sourcepub const STRATEGY_MIN_TIME: Self
pub const STRATEGY_MIN_TIME: Self
Allocation strategy that tries to minimize allocation time.
Sourcepub const STRATEGY_MIN_FRAGMENTATION: Self
pub const STRATEGY_MIN_FRAGMENTATION: Self
Allocation strategy that tries to minimize memory fragmentation.
Sourcepub const STRATEGY_MASK: Self
pub const STRATEGY_MASK: Self
A bit mask to extract only *_STRATEGY bits from entire set of flags.
Sourcepub const fn from_bits(bits: u32) -> Option<Self>
pub const fn from_bits(bits: u32) -> Option<Self>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
Sourcepub const fn from_bits_truncate(bits: u32) -> Self
pub const fn from_bits_truncate(bits: u32) -> Self
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
Sourcepub const unsafe fn from_bits_unchecked(bits: u32) -> Self
pub const unsafe fn from_bits_unchecked(bits: u32) -> Self
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
§Safety
The caller of the bitflags! macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked() has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
Sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Returns true if there are flags common to both self and other.
Sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Returns true if all of the flags in other are contained within self.
Sourcepub fn set(&mut self, other: Self, value: bool)
pub fn set(&mut self, other: Self, value: bool)
Inserts or removes the specified flags depending on the passed value.
Sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
Returns the intersection between the flags in self and
other.
Specifically, the returned set contains only the flags which are
present in both self and other.
This is equivalent to using the & operator (e.g.
ops::BitAnd), as in flags & other.
Sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
Returns the union of between the flags in self and other.
Specifically, the returned set contains all flags which are
present in either self or other, including any which are
present in both (see Self::symmetric_difference if that
is undesirable).
This is equivalent to using the | operator (e.g.
ops::BitOr), as in flags | other.
Sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
Returns the difference between the flags in self and other.
Specifically, the returned set contains all flags present in
self, except for the ones present in other.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other (and this syntax is also supported).
This is equivalent to using the - operator (e.g.
ops::Sub), as in flags - other.
Sourcepub const fn symmetric_difference(self, other: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
Returns the symmetric difference between the flags
in self and other.
Specifically, the returned set contains the flags present which
are present in self or other, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self and other.
This is equivalent to using the ^ operator (e.g.
ops::BitXor), as in flags ^ other.
Sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all() and self (e.g. Self::all() - self)
This is equivalent to using the ! operator (e.g.
ops::Not), as in !flags.
Trait Implementations§
Source§impl Binary for AllocationCreateFlags
impl Binary for AllocationCreateFlags
Source§impl BitAnd for AllocationCreateFlags
impl BitAnd for AllocationCreateFlags
Source§impl BitAndAssign for AllocationCreateFlags
impl BitAndAssign for AllocationCreateFlags
Source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Disables all flags disabled in the set.
Source§impl BitOr for AllocationCreateFlags
impl BitOr for AllocationCreateFlags
Source§fn bitor(self, other: AllocationCreateFlags) -> Self
fn bitor(self, other: AllocationCreateFlags) -> Self
Returns the union of the two sets of flags.
Source§type Output = AllocationCreateFlags
type Output = AllocationCreateFlags
| operator.Source§impl BitOrAssign for AllocationCreateFlags
impl BitOrAssign for AllocationCreateFlags
Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Adds the set of flags.
Source§impl BitXor for AllocationCreateFlags
impl BitXor for AllocationCreateFlags
Source§impl BitXorAssign for AllocationCreateFlags
impl BitXorAssign for AllocationCreateFlags
Source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Toggles the set of flags.
Source§impl Clone for AllocationCreateFlags
impl Clone for AllocationCreateFlags
Source§fn clone(&self) -> AllocationCreateFlags
fn clone(&self) -> AllocationCreateFlags
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AllocationCreateFlags
impl Debug for AllocationCreateFlags
Source§impl Extend<AllocationCreateFlags> for AllocationCreateFlags
impl Extend<AllocationCreateFlags> for AllocationCreateFlags
Source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl FromIterator<AllocationCreateFlags> for AllocationCreateFlags
impl FromIterator<AllocationCreateFlags> for AllocationCreateFlags
Source§fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
Source§impl Hash for AllocationCreateFlags
impl Hash for AllocationCreateFlags
Source§impl LowerHex for AllocationCreateFlags
impl LowerHex for AllocationCreateFlags
Source§impl Not for AllocationCreateFlags
impl Not for AllocationCreateFlags
Source§impl Octal for AllocationCreateFlags
impl Octal for AllocationCreateFlags
Source§impl Ord for AllocationCreateFlags
impl Ord for AllocationCreateFlags
Source§fn cmp(&self, other: &AllocationCreateFlags) -> Ordering
fn cmp(&self, other: &AllocationCreateFlags) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for AllocationCreateFlags
impl PartialEq for AllocationCreateFlags
Source§impl PartialOrd for AllocationCreateFlags
impl PartialOrd for AllocationCreateFlags
Source§impl Sub for AllocationCreateFlags
impl Sub for AllocationCreateFlags
Source§impl SubAssign for AllocationCreateFlags
impl SubAssign for AllocationCreateFlags
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Disables all flags enabled in the set.