Struct wgpu_util::DynamicBuffer[][src]

pub struct DynamicBuffer { /* fields omitted */ }

A wgpu::Buffer which dynamically grows based on the contents.

Implementations

impl DynamicBuffer[src]

pub fn new(device: &Device, descriptor: &BufferDescriptor<'_>) -> Self[src]

Create a new empty buffer.

pub fn new_init(device: &Device, descriptor: &BufferInitDescriptor<'_>) -> Self[src]

Create a new buffer with contents.

pub fn upload(&mut self, device: &Device, queue: &Queue, contents: &[u8])[src]

Uploads contents and resizes the buffer if needed.

If contents fits, uploads using wgpu::Queue, otherwise reallocates and uploads using wgpu::Device.

pub fn try_upload(
    &mut self,
    queue: &Queue,
    contents: &[u8]
) -> Result<(), BufferAddress>
[src]

Uploades data using wgpu::Queue without resizing. Fails if data doesn’t fit in buffers and returns the size difference.

pub fn upload_by_init(&mut self, device: &Device, contents: &[u8])[src]

Allocates a new buffer, replaces the old one and uploades the contents using wgpu::Device.

pub fn raw(&self) -> &Buffer[src]

Get a reference to the raw buffer.

pub fn into_raw(self) -> Buffer[src]

Convert into raw buffer.

Trait Implementations

impl Debug for DynamicBuffer[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Downcast<T> for T

pub fn downcast(&self) -> &T

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> Upcast<T> for T

pub fn upcast(&self) -> Option<&T>