Skip to main content

copy_into_larger

Function copy_into_larger 

Source
fn copy_into_larger(
    device: &Device,
    queue: &Queue,
    buffer: &Buffer,
    label: &'static str,
    usage: BufferUsages,
    old_size: u64,
    new_size: u64,
) -> Buffer
Expand description

Replaces buffer with a larger one, copying old_size bytes across.

A buffer cannot be resized, so growing one means creating another and copying into it — which also means the buffers the pool hands out change under a caller that held one. The copy covers only what was in use, so a buffer that has never been written to costs nothing to grow.