From 3d7ae9dc920536d41729e7bfd9548ea4bfc6fe44 Mon Sep 17 00:00:00 2001 From: Marc Pabst <2624210+marcpabst@users.noreply.github.com> Date: Tue, 1 Apr 2025 01:15:35 +0100 Subject: [PATCH] Allow to get raw swap chain from DX12 surface (#7399) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * allow to get raw swap_chain from dx12 surface * Update wgpu-hal/src/dx12/mod.rs Co-authored-by: Connor Fitzgerald * allow obtaining IDXGISwapChain3 directly --------- Co-authored-by: Marc Pabst Co-authored-by: Connor Fitzgerald Co-authored-by: Marc Pabst <“marcpabst@users.noreply.github.com”> --- wgpu-hal/src/dx12/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wgpu-hal/src/dx12/mod.rs b/wgpu-hal/src/dx12/mod.rs index 48fcbee6e..3099e7614 100644 --- a/wgpu-hal/src/dx12/mod.rs +++ b/wgpu-hal/src/dx12/mod.rs @@ -546,6 +546,12 @@ pub struct Surface { unsafe impl Send for Surface {} unsafe impl Sync for Surface {} +impl Surface { + pub fn swap_chain(&self) -> Option { + Some(self.swap_chain.read().as_ref()?.raw.clone()) + } +} + #[derive(Debug, Clone, Copy)] enum MemoryArchitecture { Unified {