fn resize_staging_buffer(&mut self, render_resource_context: &dyn RenderResourceContext) {
        // TODO: allow staging buffer to scale down
        if self.required_staging_buffer_size > self.staging_buffer_size {
            if let Some(staging_buffer) = self.staging_buffer {
                render_resource_context.remove_buffer(staging_buffer);
            }

            if self.required_staging_buffer_size > 0 {
                let staging_buffer = render_resource_context.create_buffer(BufferInfo {
                    buffer_usage: BufferUsage::COPY_SRC | BufferUsage::MAP_WRITE,
                    size: self.required_staging_buffer_size,
                    ..Default::default()
                });
                self.staging_buffer = Some(staging_buffer);
            } else {
                self.staging_buffer = None;
            }

            self.staging_buffer_size = self.required_staging_buffer_size;
        }
    }
/// Update the staging buffer to provide enough space to copy data to target buffers.
Update the staging buffer to provide enough space to copy data to target buffers.
Update the staging buffer to provide enough space to copy data to target buffers .
fn resize_staging_buffer(&mut self, render_resource_context: &dyn RenderResourceContext) {
        // TODO: allow staging buffer to scale down
        if self.required_staging_buffer_size > self.staging_buffer_size {
            if let Some(staging_buffer) = self.staging_buffer {
                render_resource_context.remove_buffer(staging_buffer);
            }
            if self.required_staging_buffer_size > 0 {
                let staging_buffer = render_resource_context.create_buffer(BufferInfo {
                    buffer_usage: BufferUsage::COPY_SRC | BufferUsage::MAP_WRITE,
                    size: self.required_staging_buffer_size,
                    ..Default::default()
                });
                self.staging_buffer = Some(staging_buffer);
            } else {
                self.staging_buffer = None;
            }
            self.staging_buffer_size = self.required_staging_buffer_size;
        }
    }
fn resize_staging_buffer ( & mut self , render_resource_context : & dyn RenderResourceContext ) { // TODO: allow staging buffer to scale down if self . required_staging_buffer_size > self . staging_buffer_size { if let Some ( staging_buffer ) = self . staging_buffer { render_resource_context . remove_buffer ( staging_buffer ) ; } if self . required_staging_buffer_size > 0 { let staging_buffer = render_resource_context . create_buffer ( BufferInfo { buffer_usage : BufferUsage :: COPY_SRC | BufferUsage :: MAP_WRITE , size : self . required_staging_buffer_size , .. Default :: default ( ) } ) ; self . staging_buffer = Some ( staging_buffer ) ; } else { self . staging_buffer = None ; } self . staging_buffer_size = self . required_staging_buffer_size ; } }
Update the staging buffer to provide enough space to copy data to target buffers.
Update the staging buffer to provide enough space to copy data to target buffers .
&mut self
render_resource_context
&dyn RenderResourceContext
&mut self
render_resource_context
&dyn RenderResourceContext