pub fn capture(
        &self,
        device: &wgpu::Device,
        encoder: &mut wgpu::CommandEncoder,
        src_texture: &wgpu::Texture,
    ) -> Snapshot {
        let buffer_image = if src_texture.format() != Self::DST_FORMAT {
            let mut converter_data_pair = self
                .converter_data_pair
                .lock()
                .expect("failed to lock converter");

            // Create converter and target texture if they don't exist.
            let converter_data_pair = converter_data_pair
                .get_or_insert_with(|| create_converter_data_pair(device, src_texture));

            // If the texture has changed in some way, recreate the converter.
            if !wgpu::texture_descriptor_eq(
                src_texture.descriptor(),
                &converter_data_pair.src_descriptor,
            ) {
                *converter_data_pair = create_converter_data_pair(device, src_texture);
            }

            // Encode the texture format conversion.
            let dst_view = converter_data_pair.dst_texture.create_default_view();
            converter_data_pair
                .reshaper
                .encode_render_pass(&dst_view, encoder);

            converter_data_pair
                .dst_texture
                .to_image(device, encoder)
                .expect("texture has unsupported format")
        } else {
            src_texture
                .to_image(device, encoder)
                .expect("texture has unsupported format")
        };

        Snapshot {
            buffer: buffer_image,
            thread_pool: self.thread_pool.clone(),
            num_threads: self.num_threads,
        }
    }
/// Capture the given texture at the state of the given command encoder.
Capture the given texture at the state of the given command encoder.
Capture the given texture at the state of the given command encoder .
pub fn capture(
        &self,
        device: &wgpu::Device,
        encoder: &mut wgpu::CommandEncoder,
        src_texture: &wgpu::Texture,
    ) -> Snapshot {
        let buffer_image = if src_texture.format() != Self::DST_FORMAT {
            let mut converter_data_pair = self
                .converter_data_pair
                .lock()
                .expect("failed to lock converter");
            // Create converter and target texture if they don't exist.
            let converter_data_pair = converter_data_pair
                .get_or_insert_with(|| create_converter_data_pair(device, src_texture));
            // If the texture has changed in some way, recreate the converter.
            if !wgpu::texture_descriptor_eq(
                src_texture.descriptor(),
                &converter_data_pair.src_descriptor,
            ) {
                *converter_data_pair = create_converter_data_pair(device, src_texture);
            }
            // Encode the texture format conversion.
            let dst_view = converter_data_pair.dst_texture.create_default_view();
            converter_data_pair
                .reshaper
                .encode_render_pass(&dst_view, encoder);
            converter_data_pair
                .dst_texture
                .to_image(device, encoder)
                .expect("texture has unsupported format")
        } else {
            src_texture
                .to_image(device, encoder)
                .expect("texture has unsupported format")
        };
        Snapshot {
            buffer: buffer_image,
            thread_pool: self.thread_pool.clone(),
            num_threads: self.num_threads,
        }
    }
pub fn capture ( & self , device : & wgpu :: Device , encoder : & mut wgpu :: CommandEncoder , src_texture : & wgpu :: Texture , ) -> Snapshot { let buffer_image = if src_texture . format ( ) != Self :: DST_FORMAT { let mut converter_data_pair = self . converter_data_pair . lock ( ) . expect ( " " ) ; // Create converter and target texture if they don't exist. let converter_data_pair = converter_data_pair . get_or_insert_with ( | | create_converter_data_pair ( device , src_texture ) ) ; // If the texture has changed in some way, recreate the converter. if ! wgpu :: texture_descriptor_eq ( src_texture . descriptor ( ) , & converter_data_pair . src_descriptor , ) { * converter_data_pair = create_converter_data_pair ( device , src_texture ) ; } // Encode the texture format conversion. let dst_view = converter_data_pair . dst_texture . create_default_view ( ) ; converter_data_pair . reshaper . encode_render_pass ( & dst_view , encoder ) ; converter_data_pair . dst_texture . to_image ( device , encoder ) . expect ( " " ) } else { src_texture . to_image ( device , encoder ) . expect ( " " ) } ; Snapshot { buffer : buffer_image , thread_pool : self . thread_pool . clone ( ) , num_threads : self . num_threads , } }
Capture the given texture at the state of the given command encoder.
Capture the given texture at the state of the given command encoder .
&self
device
&wgpu::Device
encoder
&mut wgpu::CommandEncoder
src_texture
&wgpu::Texture
&self
device
&wgpu::Device
encoder
&mut wgpu::CommandEncoder
src_texture
&wgpu::Texture