diff --git a/CHANGELOG.md b/CHANGELOG.md index cdd5e0d94..afc5cc932 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,12 @@ Bottom level categories: ## Unreleased +### Added/New Features + +#### Hal + +- Add `BufferBinding::buffer`, a public read accessor for the bound buffer, which was previously inaccessible to out-of-tree `wgpu_hal::Api` implementations. By @danlehmann in [#9820](https://github.com/gfx-rs/wgpu/pull/9820). + ### Bug Fixes #### GLES diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index d4bfc287c..34f0d68d3 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -2344,7 +2344,8 @@ pub struct BufferBinding<'a, B: DynBuffer + ?Sized> { /// /// This is not fully `pub` to prevent direct construction of /// `BufferBinding`s, while still allowing public read access to the `offset` - /// and `size` properties. + /// and `size` properties. Read access to the buffer is available via + /// [`Self::buffer`]. pub(crate) buffer: &'a B, /// The offset at which the bound region starts. @@ -2427,6 +2428,11 @@ impl<'a, B: DynBuffer + ?Sized> BufferBinding<'a, B> { size: size.into(), } } + + /// The buffer being bound. + pub fn buffer(&self) -> &'a B { + self.buffer + } } #[derive(Debug)]