Fix capture example panic in the browser (#4043)

This commit is contained in:
Jinlei Li authored and GitHub committed 2023-08-13 16:06:22 +02:00
1 parent 014ae3fe43
commit cda3f21652
1 file changed
+5 -5
+5 -5
View File
@@ -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(