fn update_buffer(
        &mut self,
        device: &wgpu::Device,
        queue: &wgpu::Queue,
        buffer_type: &BufferType,
        index: usize,
        data: &[u8],
    ) {
        let (buffer, storage, label) = match buffer_type {
            BufferType::Index => (
                &mut self.index_buffers[index],
                wgpu::BufferUsages::INDEX,
                "egui_index_buffer",
            ),
            BufferType::Vertex => (
                &mut self.vertex_buffers[index],
                wgpu::BufferUsages::VERTEX,
                "egui_vertex_buffer",
            ),
            BufferType::Uniform => (
                &mut self.uniform_buffer,
                wgpu::BufferUsages::UNIFORM,
                "egui_uniform_buffer",
            ),
        };

        if data.len() > buffer.size {
            buffer.size = data.len();
            buffer.buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
                label: Some(label),
                contents: bytemuck::cast_slice(data),
                usage: storage | wgpu::BufferUsages::COPY_DST,
            });
        } else {
            queue.write_buffer(&buffer.buffer, 0, data);
        }
    }
/// Updates the buffers used by egui. Will properly re-size the buffers if needed.
Updates the buffers used by egui. Will properly re-size the buffers if needed.
Updates the buffers used by egui . Will properly re - size the buffers if needed .
fn update_buffer(
        &mut self,
        device: &wgpu::Device,
        queue: &wgpu::Queue,
        buffer_type: &BufferType,
        index: usize,
        data: &[u8],
    ) {
        let (buffer, storage, label) = match buffer_type {
            BufferType::Index => (
                &mut self.index_buffers[index],
                wgpu::BufferUsages::INDEX,
                "egui_index_buffer",
            ),
            BufferType::Vertex => (
                &mut self.vertex_buffers[index],
                wgpu::BufferUsages::VERTEX,
                "egui_vertex_buffer",
            ),
            BufferType::Uniform => (
                &mut self.uniform_buffer,
                wgpu::BufferUsages::UNIFORM,
                "egui_uniform_buffer",
            ),
        };
        if data.len() > buffer.size {
            buffer.size = data.len();
            buffer.buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
                label: Some(label),
                contents: bytemuck::cast_slice(data),
                usage: storage | wgpu::BufferUsages::COPY_DST,
            });
        } else {
            queue.write_buffer(&buffer.buffer, 0, data);
        }
    }
fn update_buffer ( & mut self , device : & wgpu :: Device , queue : & wgpu :: Queue , buffer_type : & BufferType , index : usize , data : & [ u8 ] , ) { let ( buffer , storage , label ) = match buffer_type { BufferType :: Index => ( & mut self . index_buffers [ index ] , wgpu :: BufferUsages :: INDEX , " " , ) , BufferType :: Vertex => ( & mut self . vertex_buffers [ index ] , wgpu :: BufferUsages :: VERTEX , " " , ) , BufferType :: Uniform => ( & mut self . uniform_buffer , wgpu :: BufferUsages :: UNIFORM , " " , ) , } ; if data . len ( ) > buffer . size { buffer . size = data . len ( ) ; buffer . buffer = device . create_buffer_init ( & wgpu :: util :: BufferInitDescriptor { label : Some ( label ) , contents : bytemuck :: cast_slice ( data ) , usage : storage | wgpu :: BufferUsages :: COPY_DST , } ) ; } else { queue . write_buffer ( & buffer . buffer , 0 , data ) ; } }
Updates the buffers used by egui.
Updates the buffers used by egui .
&mut self
device
&wgpu::Device
queue
&wgpu::Queue
buffer_type
&BufferType
index
usize
data
&[u8]
&mut self
device
&wgpu::Device
queue
&wgpu::Queue
buffer_type
&BufferType
index
usize
data
&[u8]