fn resize_impl(&mut self, size: u64, copy: bool) {
        if copy {
            self.usages |= wgpu::BufferUsages::COPY_DST
        };
        // Create the new buffer
        let new_buffer = self.gpu.device.create_buffer(&wgpu::BufferDescriptor {
            label: Some(&self.label),
            size,
            usage: self.usages,
            mapped_at_creation: false,
        });
        if copy {
            // Copy the contents of the old buffer to the new buffer
            let mut encoder = self
                .gpu
                .create_command_encoder("agpu::Buffer::resize_impl() command encoder");
            self.copy_to(&mut encoder, &new_buffer);
            self.gpu.queue.submit([encoder.finish()]);
        };
        // Destroy the old buffer
        self.inner.destroy();
        // Update the inner buffer
        self.inner = new_buffer;
        // Update the size
        self.size = size;
    }
/// Resizes the buffer (does not check if the buffer is bigger)
/// Currently the encoder is immediately submitted which may cause a
/// performance hit
Resizes the buffer (does not check if the buffer is bigger)
Currently the encoder is immediately submitted which may cause a
performance hit
Resizes the buffer ( does not check if the buffer is bigger ) Currently the encoder is immediately submitted which may cause a performance hit
fn resize_impl(&mut self, size: u64, copy: bool) {
        if copy {
            self.usages |= wgpu::BufferUsages::COPY_DST
        };
        // Create the new buffer
        let new_buffer = self.gpu.device.create_buffer(&wgpu::BufferDescriptor {
            label: Some(&self.label),
            size,
            usage: self.usages,
            mapped_at_creation: false,
        });
        if copy {
            // Copy the contents of the old buffer to the new buffer
            let mut encoder = self
                .gpu
                .create_command_encoder("agpu::Buffer::resize_impl() command encoder");
            self.copy_to(&mut encoder, &new_buffer);
            self.gpu.queue.submit([encoder.finish()]);
        };
        // Destroy the old buffer
        self.inner.destroy();
        // Update the inner buffer
        self.inner = new_buffer;
        // Update the size
        self.size = size;
    }
fn resize_impl ( & mut self , size : u64 , copy : bool ) { if copy { self . usages |= wgpu :: BufferUsages :: COPY_DST } ; // Create the new buffer let new_buffer = self . gpu . device . create_buffer ( & wgpu :: BufferDescriptor { label : Some ( & self . label ) , size , usage : self . usages , mapped_at_creation : false , } ) ; if copy { // Copy the contents of the old buffer to the new buffer let mut encoder = self . gpu . create_command_encoder ( " " ) ; self . copy_to ( & mut encoder , & new_buffer ) ; self . gpu . queue . submit ( [ encoder . finish ( ) ] ) ; } ; // Destroy the old buffer self . inner . destroy ( ) ; // Update the inner buffer self . inner = new_buffer ; // Update the size self . size = size ; }
Resizes the buffer (does not check if the buffer is bigger)
Currently the encoder is immediately submitted which may cause a
performance hit
Resizes the buffer ( does not check if the buffer is bigger ) Currently the encoder is immediately submitted which may cause a performance hit
&mut self
size
u64
copy
bool
&mut self
size
u64
copy
bool