pub struct BufferUsage { /* private fields */ }
Expand description
Different ways that you can use a buffer.
The usages determine what kind of memory the buffer is allocated from and what actions the buffer can partake in.
Implementations§
Source§impl BufferUsage
impl BufferUsage
Sourcepub const MAP_READ: BufferUsage
pub const MAP_READ: BufferUsage
Allow a buffer to be mapped for reading using [Buffer::map_async
] + [Buffer::get_mapped_range
].
This does not include creating a buffer with BufferDescriptor::mapped_at_creation
set.
If Features::MAPPABLE_PRIMARY_BUFFERS
isn’t enabled, the only other usage a buffer
may have is COPY_DST.
Sourcepub const MAP_WRITE: BufferUsage
pub const MAP_WRITE: BufferUsage
Allow a buffer to be mapped for writing using [Buffer::map_async
] + [Buffer::get_mapped_range_mut
].
This does not include creating a buffer with mapped_at_creation
set.
If Features::MAPPABLE_PRIMARY_BUFFERS
feature isn’t enabled, the only other usage a buffer
may have is COPY_SRC.
Sourcepub const COPY_SRC: BufferUsage
pub const COPY_SRC: BufferUsage
Allow a buffer to be the source buffer for a [CommandEncoder::copy_buffer_to_buffer
] or [CommandEncoder::copy_buffer_to_texture
]
operation.
Sourcepub const COPY_DST: BufferUsage
pub const COPY_DST: BufferUsage
Allow a buffer to be the source buffer for a [CommandEncoder::copy_buffer_to_buffer
], [CommandEncoder::copy_buffer_to_texture
],
or [Queue::write_buffer
] operation.
Sourcepub const INDEX: BufferUsage
pub const INDEX: BufferUsage
Allow a buffer to be the index buffer in a draw operation.
Sourcepub const VERTEX: BufferUsage
pub const VERTEX: BufferUsage
Allow a buffer to be the vertex buffer in a draw operation.
Sourcepub const UNIFORM: BufferUsage
pub const UNIFORM: BufferUsage
Allow a buffer to be a BindingType::UniformBuffer
inside a bind group.
Sourcepub const STORAGE: BufferUsage
pub const STORAGE: BufferUsage
Allow a buffer to be a BindingType::StorageBuffer
inside a bind group.
Sourcepub const INDIRECT: BufferUsage
pub const INDIRECT: BufferUsage
Allow a buffer to be the indirect buffer in an indirect draw call.
Sourcepub const fn empty() -> BufferUsage
pub const fn empty() -> BufferUsage
Returns an empty set of flags
Sourcepub const fn all() -> BufferUsage
pub const fn all() -> BufferUsage
Returns the set containing all flags.
Sourcepub fn from_bits(bits: u32) -> Option<BufferUsage>
pub fn from_bits(bits: u32) -> Option<BufferUsage>
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) -> BufferUsage
pub const fn from_bits_truncate(bits: u32) -> BufferUsage
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
Sourcepub const unsafe fn from_bits_unchecked(bits: u32) -> BufferUsage
pub const unsafe fn from_bits_unchecked(bits: u32) -> BufferUsage
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Sourcepub const fn intersects(&self, other: BufferUsage) -> bool
pub const fn intersects(&self, other: BufferUsage) -> bool
Returns true
if there are flags common to both self
and other
.
Sourcepub const fn contains(&self, other: BufferUsage) -> bool
pub const fn contains(&self, other: BufferUsage) -> bool
Returns true
all of the flags in other
are contained within self
.
Sourcepub fn insert(&mut self, other: BufferUsage)
pub fn insert(&mut self, other: BufferUsage)
Inserts the specified flags in-place.
Sourcepub fn remove(&mut self, other: BufferUsage)
pub fn remove(&mut self, other: BufferUsage)
Removes the specified flags in-place.
Sourcepub fn toggle(&mut self, other: BufferUsage)
pub fn toggle(&mut self, other: BufferUsage)
Toggles the specified flags in-place.
Sourcepub fn set(&mut self, other: BufferUsage, value: bool)
pub fn set(&mut self, other: BufferUsage, value: bool)
Inserts or removes the specified flags depending on the passed value.
Trait Implementations§
Source§impl Binary for BufferUsage
impl Binary for BufferUsage
Source§impl BitAnd for BufferUsage
impl BitAnd for BufferUsage
Source§fn bitand(self, other: BufferUsage) -> BufferUsage
fn bitand(self, other: BufferUsage) -> BufferUsage
Returns the intersection between the two sets of flags.
Source§type Output = BufferUsage
type Output = BufferUsage
&
operator.Source§impl BitAndAssign for BufferUsage
impl BitAndAssign for BufferUsage
Source§fn bitand_assign(&mut self, other: BufferUsage)
fn bitand_assign(&mut self, other: BufferUsage)
Disables all flags disabled in the set.
Source§impl BitOr for BufferUsage
impl BitOr for BufferUsage
Source§fn bitor(self, other: BufferUsage) -> BufferUsage
fn bitor(self, other: BufferUsage) -> BufferUsage
Returns the union of the two sets of flags.
Source§type Output = BufferUsage
type Output = BufferUsage
|
operator.Source§impl BitOrAssign for BufferUsage
impl BitOrAssign for BufferUsage
Source§fn bitor_assign(&mut self, other: BufferUsage)
fn bitor_assign(&mut self, other: BufferUsage)
Adds the set of flags.
Source§impl BitXor for BufferUsage
impl BitXor for BufferUsage
Source§fn bitxor(self, other: BufferUsage) -> BufferUsage
fn bitxor(self, other: BufferUsage) -> BufferUsage
Returns the left flags, but with all the right flags toggled.
Source§type Output = BufferUsage
type Output = BufferUsage
^
operator.Source§impl BitXorAssign for BufferUsage
impl BitXorAssign for BufferUsage
Source§fn bitxor_assign(&mut self, other: BufferUsage)
fn bitxor_assign(&mut self, other: BufferUsage)
Toggles the set of flags.
Source§impl Clone for BufferUsage
impl Clone for BufferUsage
Source§fn clone(&self) -> BufferUsage
fn clone(&self) -> BufferUsage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BufferUsage
impl Debug for BufferUsage
Source§impl<'de> Deserialize<'de> for BufferUsage
impl<'de> Deserialize<'de> for BufferUsage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BufferUsage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BufferUsage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Extend<BufferUsage> for BufferUsage
impl Extend<BufferUsage> for BufferUsage
Source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = BufferUsage>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = BufferUsage>,
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<BufferUsage> for BufferUsage
impl FromIterator<BufferUsage> for BufferUsage
Source§fn from_iter<T>(iterator: T) -> BufferUsagewhere
T: IntoIterator<Item = BufferUsage>,
fn from_iter<T>(iterator: T) -> BufferUsagewhere
T: IntoIterator<Item = BufferUsage>,
Source§impl Hash for BufferUsage
impl Hash for BufferUsage
Source§impl LowerHex for BufferUsage
impl LowerHex for BufferUsage
Source§impl Not for BufferUsage
impl Not for BufferUsage
Source§fn not(self) -> BufferUsage
fn not(self) -> BufferUsage
Returns the complement of this set of flags.
Source§type Output = BufferUsage
type Output = BufferUsage
!
operator.Source§impl Octal for BufferUsage
impl Octal for BufferUsage
Source§impl Ord for BufferUsage
impl Ord for BufferUsage
Source§fn cmp(&self, other: &BufferUsage) -> Ordering
fn cmp(&self, other: &BufferUsage) -> 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 BufferUsage
impl PartialEq for BufferUsage
Source§impl PartialOrd for BufferUsage
impl PartialOrd for BufferUsage
Source§impl Serialize for BufferUsage
impl Serialize for BufferUsage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl Sub for BufferUsage
impl Sub for BufferUsage
Source§fn sub(self, other: BufferUsage) -> BufferUsage
fn sub(self, other: BufferUsage) -> BufferUsage
Returns the set difference of the two sets of flags.
Source§type Output = BufferUsage
type Output = BufferUsage
-
operator.Source§impl SubAssign for BufferUsage
impl SubAssign for BufferUsage
Source§fn sub_assign(&mut self, other: BufferUsage)
fn sub_assign(&mut self, other: BufferUsage)
Disables all flags enabled in the set.