diff --git a/wgpu/examples/capture/main.rs b/wgpu/examples/capture/main.rs index f1942704e5..c4fabdf0a2 100644 --- a/wgpu/examples/capture/main.rs +++ b/wgpu/examples/capture/main.rs @@ -153,6 +153,10 @@ async fn run() { } png_writer.finish().unwrap(); + // With the current interface, we have to make sure all mapped views are + // dropped before we unmap the buffer. + drop(padded_buffer); + output_buffer.unmap(); } } diff --git a/wgpu/examples/hello-compute/main.rs b/wgpu/examples/hello-compute/main.rs index 1166c74306..2eb5fec235 100644 --- a/wgpu/examples/hello-compute/main.rs +++ b/wgpu/examples/hello-compute/main.rs @@ -123,7 +123,12 @@ async fn execute_gpu(numbers: Vec) -> Vec { .chunks_exact(4) .map(|b| u32::from_ne_bytes(b.try_into().unwrap())) .collect(); + + // With the current interface, we have to make sure all mapped views are + // dropped before we unmap the buffer. + drop(data); staging_buffer.unmap(); + result } else { panic!("failed to run compute on gpu!")