Struct wgpu_util::DynamicBuffer
source · [−]pub struct DynamicBuffer { /* private fields */ }Expand description
A wgpu::Buffer which dynamically grows based on the contents.
Implementations
sourceimpl DynamicBuffer
impl DynamicBuffer
sourcepub fn new(device: &Device, descriptor: &BufferDescriptor<'_>) -> Self
pub fn new(device: &Device, descriptor: &BufferDescriptor<'_>) -> Self
Create a new empty buffer.
sourcepub fn new_init(device: &Device, descriptor: &BufferInitDescriptor<'_>) -> Self
pub fn new_init(device: &Device, descriptor: &BufferInitDescriptor<'_>) -> Self
Create a new buffer with contents.
sourcepub fn upload(&mut self, device: &Device, queue: &Queue, contents: &[u8])
pub fn upload(&mut self, device: &Device, queue: &Queue, contents: &[u8])
Uploads contents and resizes the buffer if needed.
If contents fits, uploads using wgpu::Queue, otherwise reallocates and uploads using
wgpu::Device.
sourcepub fn try_upload(
&mut self,
queue: &Queue,
contents: &[u8]
) -> Result<(), BufferAddress>
pub fn try_upload(
&mut self,
queue: &Queue,
contents: &[u8]
) -> Result<(), BufferAddress>
Uploades data using wgpu::Queue without resizing.
Fails if data doesn’t fit in buffers and returns the size difference.
sourcepub fn upload_by_init(&mut self, device: &Device, contents: &[u8])
pub fn upload_by_init(&mut self, device: &Device, contents: &[u8])
Allocates a new buffer, replaces the old one and uploades the contents using
wgpu::Device.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for DynamicBuffer
impl Send for DynamicBuffer
impl Sync for DynamicBuffer
impl Unpin for DynamicBuffer
impl !UnwindSafe for DynamicBuffer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more