pub mod app; pub mod approximate; pub mod diff; pub mod export; pub mod helper; pub mod paint; use app::App; use approximate::Approximator; use helper::write_texture; use image::EncodableLayout; use wgpu::TextureUsages; fn main() { env_logger::init_from_env("LOG"); pollster::block_on(run()); } async fn run() { let app = app::App::new().await; let App { device, queue, .. } = app.as_ref(); let img_target = image::open("a/a.png").unwrap().into_rgba8(); let size = wgpu::Extent3d { width: img_target.width(), height: img_target.height(), depth_or_array_layers: 1, }; let tex_target = device.create_texture(&wgpu::TextureDescriptor { size, mip_level_count: 1, sample_count: 1, dimension: wgpu::TextureDimension::D2, format: wgpu::TextureFormat::Rgba8Unorm, usage: TextureUsages::COPY_DST | TextureUsages::TEXTURE_BINDING | TextureUsages::COPY_SRC, label: None, }); write_texture(queue, &tex_target, img_target.as_bytes(), size); let mut a = Approximator::new(&app, tex_target, size); a.run().await; }