Skip to content

Commit

Permalink
Fix capture example panic in the browser (#4043)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinleili authored Aug 13, 2023
1 parent 014ae3f commit cda3f21
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/capture/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ async fn create_png(
//
// We pass our submission index so we don't need to wait for any other possible submissions.
device.poll(wgpu::Maintain::WaitForSubmissionIndex(submission_index));
// If a file system is available, write the buffer as a PNG
let has_file_system_available = cfg!(not(target_arch = "wasm32"));
if !has_file_system_available {
return;
}

if let Some(Ok(())) = receiver.receive().await {
// If a file system is available, write the buffer as a PNG
let has_file_system_available = cfg!(not(target_arch = "wasm32"));
if !has_file_system_available {
return;
}
let padded_buffer = buffer_slice.get_mapped_range();

let mut png_encoder = png::Encoder::new(
Expand Down

0 comments on commit cda3f21

Please sign in to comment.