mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
Fix buffer mapping examples
This commit is contained in:
1 parent
b1f3fbaab0
commit
d9ecab0cdc
2 files changed
+9
No files matched your search
@@ -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