diff options
Diffstat (limited to 'flowy/src/main.rs')
-rw-r--r-- | flowy/src/main.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/flowy/src/main.rs b/flowy/src/main.rs index 7755ab8..557417f 100644 --- a/flowy/src/main.rs +++ b/flowy/src/main.rs @@ -1,6 +1,6 @@ pub mod motion; -use motion::{enc::MotionEncoder, CommonBuffers, Params}; +use motion::{dec::MotionDecoder, enc::MotionEncoder, CommonBuffers, Params}; use pollster::FutureExt; use std::io::{stdin, stdout, Read, Write}; use wgpu::{ @@ -46,6 +46,8 @@ fn main() { height: height as u32, depth_or_array_layers: 1, }, + blocks_x: width / 8, + blocks_y: height / 8, block_width: 8, block_height: 8, blocks: (width / 8) * (height / 8), @@ -53,12 +55,16 @@ fn main() { let bufs = CommonBuffers::create(&device, ¶ms); let menc = MotionEncoder::create(&device, ¶ms, &bufs); + let mdec = MotionDecoder::create(&device, ¶ms, &bufs); let mut buffer = vec![0u8; width * height * 4]; + menc.write_uniforms(&queue); + mdec.write_uniforms(&queue); + let mut i = 0; loop { - let rp = RoundParams { swap: i }; + let rp = RoundParams { swap: i % 2 }; eprintln!("read"); stdin().read_exact(&mut buffer).unwrap(); @@ -69,7 +75,10 @@ fn main() { let mut encoder = device.create_command_encoder(&Default::default()); - menc.pass(&mut encoder, ¶ms, &rp); + if i > 1 { + menc.pass(&mut encoder, ¶ms, &rp); + mdec.pass(&mut encoder, ¶ms, &rp); + } bufs.prepare_texture_download(&mut encoder, ¶ms, &rp); queue.submit(Some(encoder.finish())); @@ -81,6 +90,5 @@ fn main() { eprintln!("write"); stdout().write_all(&buffer).unwrap(); i += 1; - i %= 2; } } |