Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove channel from neothesia-cli rendering loop
Browse files Browse the repository at this point in the history
PolyMeilex committed Feb 21, 2024
1 parent a051d7e commit 3357efa
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions neothesia-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -278,29 +278,22 @@ fn main() {

{
let slice = output_buffer.slice(..);
futures::executor::block_on(async {
let (tx, rx) = futures::channel::oneshot::channel();

slice.map_async(wgpu::MapMode::Read, move |_| {
tx.send(()).unwrap();
});

recorder.gpu.device.poll(wgpu::Maintain::Wait);
slice.map_async(wgpu::MapMode::Read, move |_| {});

rx.await.unwrap();
recorder.gpu.device.poll(wgpu::Maintain::Wait);

let mapping = slice.get_mapped_range();
let mapping = slice.get_mapped_range();

let data: &[u8] = &mapping;
encoder.encode_bgra(1920, 1080, data, false);
print!(
"\r Encoded {} frames ({}s, {}%) in {}s",
n,
(n as f32 / 60.0).round(),
(recorder.playback.percentage() * 100.0).round().min(100.0),
start.elapsed().as_secs()
);
});
let data: &[u8] = &mapping;
encoder.encode_bgra(1920, 1080, data, false);
print!(
"\r Encoded {} frames ({}s, {}%) in {}s",
n,
(n as f32 / 60.0).round(),
(recorder.playback.percentage() * 100.0).round().min(100.0),
start.elapsed().as_secs()
);
}

n += 1;

0 comments on commit 3357efa

Please sign in to comment.