mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 06:21:13 +01:00
031f6f58c521660eb071ff8263fa513b5c67e520
356: Add generic ranges to buffer mapping api and make it safe. r=kvark a=lachlansneff [Rendered](https://charted.space/notes/wgpu-rs/wgpu/struct.Buffer.html) The safety issues with the current api (being able to unmap while still holding a slice to mapped data) are fixed by having `get_mapped_range` and `get_mapped_range_mut` return `BufferView` and `BufferViewMut`, which notify the buffer that those ranges are no longer being used when they're dropped. `Buffer.unmap` asserts that the list of mapped ranges is empty, therefore it is safe. Co-authored-by: Lachlan Sneff <lachlan.sneff@gmail.com>
Languages
Rust
78.5%
WGSL
13%
GLSL
3.1%
Metal
2.8%
HLSL
2.3%
Other
0.2%