diff --git a/wgpu-hal/src/dx12/mod.rs b/wgpu-hal/src/dx12/mod.rs index 9d5f62f91..878e1e1cf 100644 --- a/wgpu-hal/src/dx12/mod.rs +++ b/wgpu-hal/src/dx12/mod.rs @@ -177,6 +177,12 @@ pub struct Surface { unsafe impl Send for Surface {} unsafe impl Sync for Surface {} +impl Surface { + pub unsafe fn swap_chain(&self) -> Option> { + self.swap_chain.read().as_ref().map(|sc| sc.raw()) + } +} + #[derive(Debug, Clone, Copy)] enum MemoryArchitecture { Unified { @@ -621,6 +627,10 @@ impl SwapChain { self.raw } + unsafe fn raw(&self) -> d3d12::ComPtr { + self.raw.clone() + } + unsafe fn wait( &mut self, timeout: Option,