Skip to content

Commit

Permalink
Add raw_handle method for metal texture (gfx-rs#6894)
Browse files Browse the repository at this point in the history
* Add `raw_handle` method for metal texture

* Add raw_handle method for metal texture (gfx-rs#6894)
  • Loading branch information
Eric Szentivanyi authored Jan 11, 2025
1 parent 44b23c3 commit 4efc992
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ By @wumpf in [#6849](https://github.com/gfx-rs/wgpu/pull/6849).

- Allow using some 32-bit floating-point atomic operations (load, store, add, sub, exchange) in shaders. It requires Metal 3.0+ with Apple 7, 8, 9 or Mac 2. By @AsherJingkongChen in [#6234](https://github.com/gfx-rs/wgpu/pull/6234).
- Add build support for Apple Vision Pro. By @guusw in [#6611](https://github.com/gfx-rs/wgpu/pull/6611).
- Add `raw_handle` method to access raw Metal textures in [#6894](https://github.com/gfx-rs/wgpu/pull/6894).

#### Changes

Expand Down
9 changes: 9 additions & 0 deletions wgpu-hal/src/metal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,15 @@ pub struct Texture {
copy_size: crate::CopyExtent,
}

impl Texture {
/// # Safety
///
/// - The texture handle must not be manually destroyed
pub unsafe fn raw_handle(&self) -> &metal::Texture {
&self.raw
}
}

impl crate::DynTexture for Texture {}

unsafe impl Send for Texture {}
Expand Down

0 comments on commit 4efc992

Please sign in to comment.