pub struct Buffer { /* private fields */ }
Expand description
A handle to a GPU buffer
The equivalent to wgpu::Buffer
Implementations§
Source§impl Buffer
impl Buffer
Sourcepub fn new(
label: Label<'_>,
usage: BufferUsages,
size: usize,
context: &Context,
) -> Self
pub fn new( label: Label<'_>, usage: BufferUsages, size: usize, context: &Context, ) -> Self
Create an empty buffer
Sourcepub fn with_data(
label: Label<'_>,
usage: BufferUsages,
data: &[u8],
context: &Context,
) -> Self
pub fn with_data( label: Label<'_>, usage: BufferUsages, data: &[u8], context: &Context, ) -> Self
Create a buffer and immediately upload data to it
Sourcepub fn ensure_capacity(&mut self, new_size: usize, context: &Context)
pub fn ensure_capacity(&mut self, new_size: usize, context: &Context)
Grow the buffer to new_size
. Does nothing if the buffer is already larger than new_size
Sourcepub fn slice<R>(&self, bounds: R) -> BufferSlicewhere
R: RangeBounds<BufferAddress>,
pub fn slice<R>(&self, bounds: R) -> BufferSlicewhere
R: RangeBounds<BufferAddress>,
Obtain a (sub) slice of the buffer
Sourcepub fn uniform_binding(&self) -> BufferBinding
pub fn uniform_binding(&self) -> BufferBinding
Bind this buffer as a uniform buffer. Must be passed to a BindGroup
Sourcepub fn storage_binding(&self, read_only: bool) -> BufferBinding
pub fn storage_binding(&self, read_only: bool) -> BufferBinding
Bind this buffer as a storage buffer. Must be passed to a BindGroup
Sourcepub fn unmap(&self)
pub fn unmap(&self)
See wgpu’s Buffer::unmap
Trait Implementations§
impl Eq for Buffer
Auto Trait Implementations§
impl Freeze for Buffer
impl !RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl !UnwindSafe for Buffer
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.