aboutsummaryrefslogtreecommitdiff
path: root/flowy/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'flowy/src/main.rs')
-rw-r--r--flowy/src/main.rs24
1 files changed, 14 insertions, 10 deletions
diff --git a/flowy/src/main.rs b/flowy/src/main.rs
index 557417f..1f84e3b 100644
--- a/flowy/src/main.rs
+++ b/flowy/src/main.rs
@@ -1,5 +1,6 @@
pub mod motion;
+use log::debug;
use motion::{dec::MotionDecoder, enc::MotionEncoder, CommonBuffers, Params};
use pollster::FutureExt;
use std::io::{stdin, stdout, Read, Write};
@@ -11,6 +12,8 @@ use wgpu::{
use crate::motion::RoundParams;
fn main() {
+ env_logger::init_from_env("LOG");
+
let instance = Instance::new(InstanceDescriptor {
backends: Backends::all(),
..Default::default()
@@ -38,6 +41,7 @@ fn main() {
.unwrap();
let (width, height) = (1920, 1080);
+ let bsize = 8;
let params = Params {
width,
height,
@@ -46,11 +50,11 @@ 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),
+ blocks_x: width / bsize,
+ blocks_y: height / bsize,
+ block_width: bsize,
+ block_height: bsize,
+ blocks: (width / bsize) * (height / bsize),
};
let bufs = CommonBuffers::create(&device, &params);
@@ -65,13 +69,13 @@ fn main() {
let mut i = 0;
loop {
let rp = RoundParams { swap: i % 2 };
- eprintln!("read");
+ debug!("read");
stdin().read_exact(&mut buffer).unwrap();
- eprintln!("upload");
+ debug!("upload");
bufs.upload(&queue, &params, &rp, &buffer);
- eprintln!("compute");
+ debug!("compute");
let mut encoder = device.create_command_encoder(&Default::default());
@@ -84,10 +88,10 @@ fn main() {
queue.submit(Some(encoder.finish()));
device.poll(MaintainBase::Wait);
- eprintln!("download");
+ debug!("download");
bufs.download(&device, &mut buffer);
- eprintln!("write");
+ debug!("write");
stdout().write_all(&buffer).unwrap();
i += 1;
}