diff options
Diffstat (limited to 'vgcodec/src/app.rs')
-rw-r--r-- | vgcodec/src/app.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/vgcodec/src/app.rs b/vgcodec/src/app.rs index 0c063a5..b51284c 100644 --- a/vgcodec/src/app.rs +++ b/vgcodec/src/app.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use wgpu::{Adapter, Device, Instance, Queue}; +use wgpu::{Adapter, Device, Extent3d, ImageCopyTexture, Instance, Origin3d, Queue, Texture}; pub struct App { pub instance: Instance, @@ -34,4 +34,26 @@ impl App { queue, }) } + + pub fn copy_texture(&self, source: &Texture, destination: &Texture, size: Extent3d) { + let mut encoder = self + .device + .create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); + encoder.copy_texture_to_texture( + ImageCopyTexture { + aspect: wgpu::TextureAspect::All, + mip_level: 0, + origin: Origin3d::ZERO, + texture: source, + }, + ImageCopyTexture { + aspect: wgpu::TextureAspect::All, + mip_level: 0, + origin: Origin3d::ZERO, + texture: destination, + }, + size, + ); + self.queue.submit(Some(encoder.finish())); + } } |