From 4efc992d6db2fb834b7c7c3b034e7495a5e3a1de Mon Sep 17 00:00:00 2001 From: Eric Szentivanyi <189901323+ericszentivanyi@users.noreply.github.com> Date: Fri, 10 Jan 2025 21:45:09 -0500 Subject: [PATCH] Add `raw_handle` method for metal texture (#6894) * Add `raw_handle` method for metal texture * Add raw_handle method for metal texture (#6894) --- CHANGELOG.md | 1 + wgpu-hal/src/metal/mod.rs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 877f91aa31..dec4ee352e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/wgpu-hal/src/metal/mod.rs b/wgpu-hal/src/metal/mod.rs index e63a2a3cce..6f0d478ef1 100644 --- a/wgpu-hal/src/metal/mod.rs +++ b/wgpu-hal/src/metal/mod.rs @@ -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 {}