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