From 110e62aed255777ac635a504ec81029483065be8 Mon Sep 17 00:00:00 2001 From: Andrew Numrich Date: Wed, 15 Mar 2023 11:48:47 -0600 Subject: [PATCH] Fix macro to allow disabling `dx12` feature. (#3590) * Fix macro for DX12 conditional compilation * Update CHANGELOG.md * Apply suggestions from code review --------- Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> --- CHANGELOG.md | 1 + wgpu/src/backend/direct.rs | 4 ++-- wgpu/src/lib.rs | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed753570e8..e209fc8541 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -118,6 +118,7 @@ By @teoxoy in [#3534](https://github.com/gfx-rs/wgpu/pull/3534) - Fix DXC validation issues when using a custom `dxil_path`. By @Elabajaba in [#3434](https://github.com/gfx-rs/wgpu/pull/3434) - Use typeless formats for textures that might be viewed as srgb or non-srgb. By @teoxoy in [#3555](https://github.com/gfx-rs/wgpu/pull/3555) +- Fix conditional compilation for `dx12` feature. By @toastmod in [#3590](https://github.com/gfx-rs/wgpu/pull/3590) #### GLES diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index e3f6bbc6c5..1b688b14a9 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -232,7 +232,7 @@ impl Context { }) } - #[cfg(target_os = "windows")] + #[cfg(all(feature = "dx12", windows))] pub unsafe fn create_surface_from_visual(&self, visual: *mut std::ffi::c_void) -> Surface { let id = unsafe { self.0.instance_create_surface_from_visual(visual, ()) }; Surface { @@ -241,7 +241,7 @@ impl Context { } } - #[cfg(target_os = "windows")] + #[cfg(all(feature = "dx12", windows))] pub unsafe fn create_surface_from_surface_handle( &self, surface_handle: *mut std::ffi::c_void, diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index ad17151ea1..5d937db745 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -1544,7 +1544,7 @@ impl Instance { /// # Safety /// /// - visual must be a valid IDCompositionVisual to create a surface upon. - #[cfg(target_os = "windows")] + #[cfg(all(feature = "dx12", windows))] pub unsafe fn create_surface_from_visual(&self, visual: *mut std::ffi::c_void) -> Surface { let surface = unsafe { self.context @@ -1566,7 +1566,7 @@ impl Instance { /// # Safety /// /// - surface_handle must be a valid SurfaceHandle to create a surface upon. - #[cfg(target_os = "windows")] + #[cfg(all(feature = "dx12", windows))] pub unsafe fn create_surface_from_surface_handle( &self, surface_handle: *mut std::ffi::c_void,