Struct BufferUsages
#[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§
§impl BufferUsages
impl BufferUsages
pub 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.
pub 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.
pub 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.
pub 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.
pub const INDEX: BufferUsages
pub const INDEX: BufferUsages
Allow a buffer to be the index buffer in a draw operation.
pub const VERTEX: BufferUsages
pub const VERTEX: BufferUsages
Allow a buffer to be the vertex buffer in a draw operation.
pub const UNIFORM: BufferUsages
pub const UNIFORM: BufferUsages
Allow a buffer to be a BufferBindingType::Uniform inside a bind group.
pub const STORAGE: BufferUsages
pub const STORAGE: BufferUsages
Allow a buffer to be a BufferBindingType::Storage inside a bind group.
pub const INDIRECT: BufferUsages
pub const INDIRECT: BufferUsages
Allow a buffer to be the indirect buffer in an indirect draw call.
pub const QUERY_RESOLVE: BufferUsages
pub const QUERY_RESOLVE: BufferUsages
Allow a buffer to be the destination buffer for a CommandEncoder::resolve_query_set operation.
pub const BLAS_INPUT: BufferUsages
pub const BLAS_INPUT: BufferUsages
Allows a buffer to be used as input for a bottom level acceleration structure build
pub const TLAS_INPUT: BufferUsages
pub const TLAS_INPUT: BufferUsages
Allows a buffer to be used as input for a top level acceleration structure build
pub const fn bits(&self) -> BufferUsagesBits
pub const fn bits(&self) -> BufferUsagesBits
Gets the set flags as a container holding an array of bits.
pub const fn empty() -> BufferUsages
pub const fn empty() -> BufferUsages
Returns self with no flags set.
pub const fn all() -> BufferUsages
pub const fn all() -> BufferUsages
Returns self with all flags set.
pub 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
pub 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.
pub const fn union(self, other: BufferUsages) -> BufferUsages
pub const fn union(self, other: BufferUsages) -> BufferUsages
Bitwise or - self | other
pub const fn intersection(self, other: BufferUsages) -> BufferUsages
pub const fn intersection(self, other: BufferUsages) -> BufferUsages
Bitwise and - self & other
pub const fn difference(self, other: BufferUsages) -> BufferUsages
pub const fn difference(self, other: BufferUsages) -> BufferUsages
Bitwise and of the complement of other - self & !other
pub const fn symmetric_difference(self, other: BufferUsages) -> BufferUsages
pub const fn symmetric_difference(self, other: BufferUsages) -> BufferUsages
Bitwise xor - self ^ other
pub const fn complement(self) -> BufferUsages
pub const fn complement(self) -> BufferUsages
Bitwise not - !self
pub 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.
pub fn insert(&mut self, other: BufferUsages)
pub fn insert(&mut self, other: BufferUsages)
Inserts specified flag(s) into self
pub fn remove(&mut self, other: BufferUsages)
pub fn remove(&mut self, other: BufferUsages)
Removes specified flag(s) from self
pub fn toggle(&mut self, other: BufferUsages)
pub fn toggle(&mut self, other: BufferUsages)
Toggles specified flag(s) in self
pub 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
pub 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)
pub 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
pub 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.
pub 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
pub const fn iter(&self) -> Iter<BufferUsages>
pub const fn iter(&self) -> Iter<BufferUsages>
Returns an iterator over the set flags.
pub 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§
§impl BitAnd for BufferUsages
impl BitAnd for BufferUsages
§type Output = BufferUsages
type Output = BufferUsages
& operator.§fn bitand(self, other: BufferUsages) -> BufferUsages
fn bitand(self, other: BufferUsages) -> BufferUsages
& operation. Read more§impl BitAndAssign for BufferUsages
impl BitAndAssign for BufferUsages
§fn bitand_assign(&mut self, other: BufferUsages)
fn bitand_assign(&mut self, other: BufferUsages)
&= operation. Read more§impl BitOr for BufferUsages
impl BitOr for BufferUsages
§type Output = BufferUsages
type Output = BufferUsages
| operator.§fn bitor(self, other: BufferUsages) -> BufferUsages
fn bitor(self, other: BufferUsages) -> BufferUsages
| operation. Read more§impl BitOrAssign for BufferUsages
impl BitOrAssign for BufferUsages
§fn bitor_assign(&mut self, other: BufferUsages)
fn bitor_assign(&mut self, other: BufferUsages)
|= operation. Read more§impl BitXor for BufferUsages
impl BitXor for BufferUsages
§type Output = BufferUsages
type Output = BufferUsages
^ operator.§fn bitxor(self, other: BufferUsages) -> BufferUsages
fn bitxor(self, other: BufferUsages) -> BufferUsages
^ operation. Read more§impl BitXorAssign for BufferUsages
impl BitXorAssign for BufferUsages
§fn bitxor_assign(&mut self, other: BufferUsages)
fn bitxor_assign(&mut self, other: BufferUsages)
^= operation. Read more§impl Clone for BufferUsages
impl Clone for BufferUsages
§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 more§impl Debug for BufferUsages
impl Debug for BufferUsages
§impl<'de> Deserialize<'de> for BufferUsages
Available on crate feature serde only.
impl<'de> Deserialize<'de> for BufferUsages
serde only.§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>,
§impl Display for BufferUsages
impl Display for BufferUsages
§impl Flags for BufferUsages
impl Flags for BufferUsages
§const FLAGS: &'static [Flag<BufferUsages>] = BufferUsages::FLAGS
const FLAGS: &'static [Flag<BufferUsages>] = BufferUsages::FLAGS
§fn from_bits_retain(bits: BufferUsagesBits) -> BufferUsages
fn from_bits_retain(bits: BufferUsagesBits) -> BufferUsages
§fn empty() -> BufferUsages
fn empty() -> BufferUsages
§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.§impl From<BufferUsagesWGPU> for BufferUsages
impl From<BufferUsagesWGPU> for BufferUsages
§fn from(buffer_usages_wgpu: BufferUsagesWGPU) -> BufferUsages
fn from(buffer_usages_wgpu: BufferUsagesWGPU) -> BufferUsages
§impl From<BufferUsagesWebGPU> for BufferUsages
impl From<BufferUsagesWebGPU> for BufferUsages
§fn from(buffer_usages_webgpu: BufferUsagesWebGPU) -> BufferUsages
fn from(buffer_usages_webgpu: BufferUsagesWebGPU) -> BufferUsages
§impl Hash for BufferUsages
impl Hash for BufferUsages
§impl Not for BufferUsages
impl Not for BufferUsages
§type Output = BufferUsages
type Output = BufferUsages
! operator.§fn not(self) -> BufferUsages
fn not(self) -> BufferUsages
! operation. Read more§impl PartialEq for BufferUsages
impl PartialEq for BufferUsages
§impl Serialize for BufferUsages
Available on crate feature serde only.
impl Serialize for BufferUsages
serde only.§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,
§impl Sub for BufferUsages
impl Sub for BufferUsages
§type Output = BufferUsages
type Output = BufferUsages
- operator.§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 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