mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[rs] Merge #366
366: Fix buffer mapping examples r=cwfitzgerald a=lachlansneff Fixes #364 Co-authored-by: Lachlan Sneff <lachlan.sneff@gmail.com>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,12 @@ async fn execute_gpu(numbers: Vec<u32>) -> Vec<u32> {
|
||||
.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!")
|
||||
|
||||
Reference in New Issue
Block a user