pub struct DynamicStorageBuffer<B> { /* private fields */ }
Expand description
Dynamic storage buffer wrapper facilitating RW operations
Implementations§
Source§impl<B> DynamicStorageBuffer<B>
impl<B> DynamicStorageBuffer<B>
Sourcepub const fn new(buffer: B) -> Self
pub const fn new(buffer: B) -> Self
Creates a new dynamic storage buffer wrapper with an alignment of 256 (default alignment in the WebGPU spec).
Sourcepub const fn new_with_alignment(buffer: B, alignment: u64) -> Self
pub const fn new_with_alignment(buffer: B, alignment: u64) -> Self
Creates a new dynamic storage buffer wrapper with a given alignment.
§Panics
- if
alignment
is not a power of two. - if
alignment
is less than 32 (min alignment imposed by the WebGPU spec).
pub fn set_offset(&mut self, offset: u64)
pub fn into_inner(self) -> B
Source§impl<B: BufferMut> DynamicStorageBuffer<B>
impl<B: BufferMut> DynamicStorageBuffer<B>
Source§impl<B: BufferRef> DynamicStorageBuffer<B>
impl<B: BufferRef> DynamicStorageBuffer<B>
pub fn read<T>(&mut self, value: &mut T) -> Result<()>
pub fn create<T>(&mut self) -> Result<T>where
T: ShaderType + CreateFrom,
Trait Implementations§
Source§impl<B> AsMut<B> for DynamicStorageBuffer<B>
impl<B> AsMut<B> for DynamicStorageBuffer<B>
Source§impl<B> AsRef<B> for DynamicStorageBuffer<B>
impl<B> AsRef<B> for DynamicStorageBuffer<B>
Auto Trait Implementations§
impl<B> Freeze for DynamicStorageBuffer<B>where
B: Freeze,
impl<B> RefUnwindSafe for DynamicStorageBuffer<B>where
B: RefUnwindSafe,
impl<B> Send for DynamicStorageBuffer<B>where
B: Send,
impl<B> Sync for DynamicStorageBuffer<B>where
B: Sync,
impl<B> Unpin for DynamicStorageBuffer<B>where
B: Unpin,
impl<B> UnwindSafe for DynamicStorageBuffer<B>where
B: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.