#[repr(C)]pub struct BufferUsages {
pub buffer_usages_webgpu: BufferUsagesWebGPU,
pub buffer_usages_wgpu: BufferUsagesWGPU,
}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.
Specifying only usages the application will actually perform may increase performance.
Additionally, on the WebGL backend, there are restrictions on BufferUsages::INDEX;
see [DownlevelFlags::UNRESTRICTED_INDEX_BUFFER] for more information.
Corresponds to WebGPU GPUBufferUsageFlags.
Fields§
§buffer_usages_webgpu: BufferUsagesWebGPU§buffer_usages_wgpu: BufferUsagesWGPUImplementations§
Source§impl BufferUsages
impl BufferUsages
Sourcepub const MAP_READ: BufferUsages
pub const MAP_READ: BufferUsages
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: BufferUsages
pub const MAP_WRITE: BufferUsages
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 BufferDescriptor::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: BufferUsages
pub const COPY_SRC: BufferUsages
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: BufferUsages
pub const COPY_DST: BufferUsages
Allow a buffer to be the destination buffer for a CommandEncoder::copy_buffer_to_buffer, CommandEncoder::copy_texture_to_buffer,
CommandEncoder::clear_buffer or Queue::write_buffer operation.
Sourcepub const INDEX: BufferUsages
pub const INDEX: BufferUsages
Allow a buffer to be the index buffer in a draw operation.
Sourcepub const VERTEX: BufferUsages
pub const VERTEX: BufferUsages
Allow a buffer to be the vertex buffer in a draw operation.
Sourcepub const UNIFORM: BufferUsages
pub const UNIFORM: BufferUsages
Allow a buffer to be a BufferBindingType::Uniform inside a bind group.
Sourcepub const STORAGE: BufferUsages
pub const STORAGE: BufferUsages
Allow a buffer to be a BufferBindingType::Storage inside a bind group.
Sourcepub const INDIRECT: BufferUsages
pub const INDIRECT: BufferUsages
Allow a buffer to be the indirect buffer in an indirect draw call.
Sourcepub const QUERY_RESOLVE: BufferUsages
pub const QUERY_RESOLVE: BufferUsages
Allow a buffer to be the destination buffer for a CommandEncoder::resolve_query_set operation.
Sourcepub const BLAS_INPUT: BufferUsages
pub const BLAS_INPUT: BufferUsages
Allows a buffer to be used as input for a bottom level acceleration structure build
Sourcepub const TLAS_INPUT: BufferUsages
pub const TLAS_INPUT: BufferUsages
Allows a buffer to be used as input for a top level acceleration structure build
Sourcepub const fn bits(&self) -> BufferUsagesBits
pub const fn bits(&self) -> BufferUsagesBits
Gets the set flags as a container holding an array of bits.
Sourcepub const fn empty() -> BufferUsages
pub const fn empty() -> BufferUsages
Returns self with no flags set.
Sourcepub const fn all() -> BufferUsages
pub const fn all() -> BufferUsages
Returns self with all flags set.
Sourcepub const fn contains(self, other: BufferUsages) -> bool
pub const fn contains(self, other: BufferUsages) -> bool
Whether all the bits set in other are all set in self
Sourcepub const fn intersects(self, other: BufferUsages) -> bool
pub const fn intersects(self, other: BufferUsages) -> bool
Returns whether any bit set in self matched any bit set in other.
Sourcepub const fn union(self, other: BufferUsages) -> BufferUsages
pub const fn union(self, other: BufferUsages) -> BufferUsages
Bitwise or - self | other
Sourcepub const fn intersection(self, other: BufferUsages) -> BufferUsages
pub const fn intersection(self, other: BufferUsages) -> BufferUsages
Bitwise and - self & other
Sourcepub const fn difference(self, other: BufferUsages) -> BufferUsages
pub const fn difference(self, other: BufferUsages) -> BufferUsages
Bitwise and of the complement of other - self & !other
Sourcepub const fn symmetric_difference(self, other: BufferUsages) -> BufferUsages
pub const fn symmetric_difference(self, other: BufferUsages) -> BufferUsages
Bitwise xor - self ^ other
Sourcepub const fn complement(self) -> BufferUsages
pub const fn complement(self) -> BufferUsages
Bitwise not - !self
Sourcepub fn set(&mut self, other: BufferUsages, set: bool)
pub fn set(&mut self, other: BufferUsages, set: bool)
Calls Self::insert if set is true and otherwise calls Self::remove.
Sourcepub fn insert(&mut self, other: BufferUsages)
pub fn insert(&mut self, other: BufferUsages)
Inserts specified flag(s) into self
Sourcepub fn remove(&mut self, other: BufferUsages)
pub fn remove(&mut self, other: BufferUsages)
Removes specified flag(s) from self
Sourcepub fn toggle(&mut self, other: BufferUsages)
pub fn toggle(&mut self, other: BufferUsages)
Toggles specified flag(s) in self
Sourcepub const fn from_bits(bits: BufferUsagesBits) -> Option<BufferUsages>
pub const fn from_bits(bits: BufferUsagesBits) -> Option<BufferUsages>
Takes in BufferUsagesBits and returns
None if there are invalid bits or otherwise Self with those bits set
Sourcepub const fn from_bits_truncate(bits: BufferUsagesBits) -> BufferUsages
pub const fn from_bits_truncate(bits: BufferUsagesBits) -> BufferUsages
Takes in BufferUsagesBits and returns Self with only valid bits (all other bits removed)
Sourcepub const fn from_bits_retain(bits: BufferUsagesBits) -> BufferUsages
pub const fn from_bits_retain(bits: BufferUsagesBits) -> BufferUsages
Takes in BufferUsagesBits and returns Self with all bits that were set without removing invalid bits
Sourcepub fn from_name(name: &str) -> Option<BufferUsages>
pub fn from_name(name: &str) -> Option<BufferUsages>
Takes in a bitflags flag name (in SCREAMING_SNAKE_CASE) and returns Self
if it matches or none if the name does not match the name of any of the
flags. Name is capitalisation dependent.
[impl FromStr] can be used to recognize kebab-case names, like are used in
the WebGPU spec.
Sourcepub fn from_internal_flags(
buffer_usages_webgpu: BufferUsagesWebGPU,
buffer_usages_wgpu: BufferUsagesWGPU,
) -> BufferUsages
pub fn from_internal_flags( buffer_usages_webgpu: BufferUsagesWebGPU, buffer_usages_wgpu: BufferUsagesWGPU, ) -> BufferUsages
Combines the flags from the internal flags into the entire flags struct
Sourcepub const fn iter(&self) -> Iter<BufferUsages>
pub const fn iter(&self) -> Iter<BufferUsages>
Returns an iterator over the set flags.
Sourcepub const fn iter_names(&self) -> IterNames<BufferUsages>
pub const fn iter_names(&self) -> IterNames<BufferUsages>
Returns an iterator over the set flags and their names.
These are bitflags names in SCREAMING_SNAKE_CASE.
Trait Implementations§
Source§impl BitAnd for BufferUsages
impl BitAnd for BufferUsages
Source§type Output = BufferUsages
type Output = BufferUsages
& operator.Source§fn bitand(self, other: BufferUsages) -> BufferUsages
fn bitand(self, other: BufferUsages) -> BufferUsages
& operation. Read moreSource§impl BitAndAssign for BufferUsages
impl BitAndAssign for BufferUsages
Source§fn bitand_assign(&mut self, other: BufferUsages)
fn bitand_assign(&mut self, other: BufferUsages)
&= operation. Read moreSource§impl BitOr for BufferUsages
impl BitOr for BufferUsages
Source§type Output = BufferUsages
type Output = BufferUsages
| operator.Source§fn bitor(self, other: BufferUsages) -> BufferUsages
fn bitor(self, other: BufferUsages) -> BufferUsages
| operation. Read moreSource§impl BitOrAssign for BufferUsages
impl BitOrAssign for BufferUsages
Source§fn bitor_assign(&mut self, other: BufferUsages)
fn bitor_assign(&mut self, other: BufferUsages)
|= operation. Read moreSource§impl BitXor for BufferUsages
impl BitXor for BufferUsages
Source§type Output = BufferUsages
type Output = BufferUsages
^ operator.Source§fn bitxor(self, other: BufferUsages) -> BufferUsages
fn bitxor(self, other: BufferUsages) -> BufferUsages
^ operation. Read moreSource§impl BitXorAssign for BufferUsages
impl BitXorAssign for BufferUsages
Source§fn bitxor_assign(&mut self, other: BufferUsages)
fn bitxor_assign(&mut self, other: BufferUsages)
^= operation. Read moreSource§impl Clone for BufferUsages
impl Clone for BufferUsages
Source§fn clone(&self) -> BufferUsages
fn clone(&self) -> BufferUsages
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BufferUsages
impl Debug for BufferUsages
Source§impl<'de> Deserialize<'de> for BufferUsages
Available on crate feature serde only.
impl<'de> Deserialize<'de> for BufferUsages
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<BufferUsages, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<BufferUsages, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Display for BufferUsages
impl Display for BufferUsages
Source§impl Flags for BufferUsages
impl Flags for BufferUsages
Source§const FLAGS: &'static [Flag<BufferUsages>] = BufferUsages::FLAGS
const FLAGS: &'static [Flag<BufferUsages>] = BufferUsages::FLAGS
Source§type Bits = BufferUsagesBits
type Bits = BufferUsagesBits
Source§fn bits(&self) -> BufferUsagesBits
fn bits(&self) -> BufferUsagesBits
Source§fn from_bits_retain(bits: BufferUsagesBits) -> BufferUsages
fn from_bits_retain(bits: BufferUsagesBits) -> BufferUsages
Source§fn empty() -> BufferUsages
fn empty() -> BufferUsages
Source§fn all() -> BufferUsages
fn all() -> BufferUsages
§fn known_bits(&self) -> Self::Bits
fn known_bits(&self) -> Self::Bits
§fn unknown_bits(&self) -> Self::Bits
fn unknown_bits(&self) -> Self::Bits
§fn contains_unknown_bits(&self) -> bool
fn contains_unknown_bits(&self) -> bool
true if any unknown bits are set.§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
§fn iter_names(&self) -> IterNames<Self>
fn iter_names(&self) -> IterNames<Self>
§fn iter_defined_names() -> IterDefinedNames<Self>
fn iter_defined_names() -> IterDefinedNames<Self>
Self::FLAGS].§fn iter_equal_names(&self) -> IterEqualNames<Self>
fn iter_equal_names(&self) -> IterEqualNames<Self>
§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|) of the bits in self and other.§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^) of the bits in self and other.§fn set(&mut self, other: Self, value: bool)where
Self: Sized,
fn set(&mut self, other: Self, value: bool)where
Self: Sized,
Flags::insert] when value is true or [Flags::remove] when value is false.§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&) of the bits in self and other.§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^) of the bits in self and other.§fn complement(self) -> Self
fn complement(self) -> Self
!) of the bits in self, truncating the result.Source§impl From<BufferUsagesWGPU> for BufferUsages
impl From<BufferUsagesWGPU> for BufferUsages
Source§fn from(buffer_usages_wgpu: BufferUsagesWGPU) -> BufferUsages
fn from(buffer_usages_wgpu: BufferUsagesWGPU) -> BufferUsages
Source§impl From<BufferUsagesWebGPU> for BufferUsages
impl From<BufferUsagesWebGPU> for BufferUsages
Source§fn from(buffer_usages_webgpu: BufferUsagesWebGPU) -> BufferUsages
fn from(buffer_usages_webgpu: BufferUsagesWebGPU) -> BufferUsages
Source§impl Hash for BufferUsages
impl Hash for BufferUsages
Source§impl Not for BufferUsages
impl Not for BufferUsages
Source§type Output = BufferUsages
type Output = BufferUsages
! operator.Source§fn not(self) -> BufferUsages
fn not(self) -> BufferUsages
! operation. Read moreSource§impl PartialEq for BufferUsages
impl PartialEq for BufferUsages
Source§impl Serialize for BufferUsages
Available on crate feature serde only.
impl Serialize for BufferUsages
serde only.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 BufferUsages
impl Sub for BufferUsages
Source§type Output = BufferUsages
type Output = BufferUsages
- operator.Source§fn sub(self, other: BufferUsages) -> BufferUsages
fn sub(self, other: BufferUsages) -> BufferUsages
- operation. Read moreimpl Copy for BufferUsages
impl Eq for BufferUsages
impl StructuralPartialEq for BufferUsages
Auto Trait Implementations§
impl Freeze for BufferUsages
impl RefUnwindSafe for BufferUsages
impl Send for BufferUsages
impl Sync for BufferUsages
impl Unpin for BufferUsages
impl UnsafeUnpin for BufferUsages
impl UnwindSafe for BufferUsages
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more