aboutsummaryrefslogtreecommitdiff
path: root/vgcodec/src/app.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-05-05 15:09:54 +0200
committermetamuffin <metamuffin@disroot.org>2025-05-05 15:09:54 +0200
commit306f96164784a8cbf405e72fa4364d6523366e95 (patch)
tree51717fc139871baa438aad806f4923669ae0896c /vgcodec/src/app.rs
parent9cc089e2d6e841879e430b01d2f3d92c8820523e (diff)
downloadvideo-codec-experiments-306f96164784a8cbf405e72fa4364d6523366e95.tar
video-codec-experiments-306f96164784a8cbf405e72fa4364d6523366e95.tar.bz2
video-codec-experiments-306f96164784a8cbf405e72fa4364d6523366e95.tar.zst
old dir
Diffstat (limited to 'vgcodec/src/app.rs')
-rw-r--r--vgcodec/src/app.rs59
1 files changed, 0 insertions, 59 deletions
diff --git a/vgcodec/src/app.rs b/vgcodec/src/app.rs
deleted file mode 100644
index b51284c..0000000
--- a/vgcodec/src/app.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-use std::sync::Arc;
-
-use wgpu::{Adapter, Device, Extent3d, ImageCopyTexture, Instance, Origin3d, Queue, Texture};
-
-pub struct App {
- pub instance: Instance,
- pub device: Device,
- pub adapter: Adapter,
- pub queue: Queue,
-}
-
-impl App {
- pub async fn new() -> Arc<Self> {
- let instance = wgpu::Instance::new(wgpu::Backends::all());
- let adapter = instance
- .request_adapter(&wgpu::RequestAdapterOptions::default())
- .await
- .unwrap();
- let (device, queue) = adapter
- .request_device(
- &wgpu::DeviceDescriptor {
- label: None,
- features: wgpu::Features::empty(),
- limits: wgpu::Limits::downlevel_defaults(),
- },
- None,
- )
- .await
- .unwrap();
- Arc::new(Self {
- adapter,
- device,
- instance,
- 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()));
- }
-}