Skip to content

Commit

Permalink
move(hal,dx11,dx12): use local path dep. for d3d12
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler committed Sep 20, 2023
1 parent c59f2b0 commit 5cfeea5
Showing 6 changed files with 35 additions and 31 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ android_system_properties = "0.1.1"
# DX dependencies
bit-set = "0.5"
gpu-allocator = { version = "0.21", default_features = false, features = ["d3d12", "windows", "public-winapi"] }
d3d12 = "0.7.0"
d3d12 = { path = "./d3d12/" }
range-alloc = "0.1"
winapi = "0.3"
hassle-rs = "0.10.0"
2 changes: 1 addition & 1 deletion wgpu-hal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ gpu-allocator = { version = "0.22", default_features = false, features = ["d3d12
hassle-rs = { version = "0.10", optional = true }

winapi = { version = "0.3", features = ["profileapi", "libloaderapi", "windef", "winuser", "dcomp"] }
d3d12 = { version = "0.7", features = ["libloading"], optional = true }
d3d12 = { path = "../d3d12/", features = ["libloading"], optional = true }

[target.'cfg(any(target_os="macos", target_os="ios"))'.dependencies]
# backend: Metal
2 changes: 1 addition & 1 deletion wgpu-hal/src/dx11/mod.rs
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ pub struct Adapter {
unsafe impl Send for Adapter {}
unsafe impl Sync for Adapter {}

d3d12::weak_com_inheritance_chain! {
d3d12::com_inheritance_chain! {
#[derive(Debug, Clone, PartialEq)]
enum D3D11Device {
Device(d3d11::ID3D11Device), from_device, as_device, device;
2 changes: 1 addition & 1 deletion wgpu-hal/src/dx12/device.rs
Original file line number Diff line number Diff line change
@@ -1025,7 +1025,7 @@ impl crate::Device<super::Api> for super::Device {
if !error.is_null() {
log::error!(
"Root signature serialization error: {:?}",
unsafe { error.as_c_str() }.to_str().unwrap()
error.as_c_str().to_str().unwrap()
);
return Err(crate::DeviceError::Lost);
}
56 changes: 31 additions & 25 deletions wgpu-hal/src/dx12/mod.rs
Original file line number Diff line number Diff line change
@@ -666,39 +666,45 @@ impl crate::Surface<Api> for Surface {
let swap_chain1 = match self.target {
SurfaceTarget::Visual(_) => {
profiling::scope!("IDXGIFactory4::CreateSwapChainForComposition");
self.factory
.unwrap_factory2()
.create_swapchain_for_composition(
device.present_queue.as_mut_ptr() as *mut _,
&desc,
)
.into_result()
unsafe {
self.factory
.unwrap_factory2()
.create_swapchain_for_composition(
device.present_queue.as_mut_ptr() as *mut _,
&desc,
)
.into_result()
}
}
SurfaceTarget::SurfaceHandle(handle) => {
profiling::scope!(
"IDXGIFactoryMedia::CreateSwapChainForCompositionSurfaceHandle"
);
self.factory_media
.clone()
.ok_or(crate::SurfaceError::Other("IDXGIFactoryMedia not found"))?
.create_swapchain_for_composition_surface_handle(
device.present_queue.as_mut_ptr() as *mut _,
handle,
&desc,
)
.into_result()
unsafe {
self.factory_media
.clone()
.ok_or(crate::SurfaceError::Other("IDXGIFactoryMedia not found"))?
.create_swapchain_for_composition_surface_handle(
device.present_queue.as_mut_ptr() as *mut _,
handle,
&desc,
)
.into_result()
}
}
SurfaceTarget::WndHandle(hwnd) => {
profiling::scope!("IDXGIFactory4::CreateSwapChainForHwnd");
self.factory
.as_factory2()
.unwrap()
.create_swapchain_for_hwnd(
device.present_queue.as_mut_ptr() as *mut _,
hwnd,
&desc,
)
.into_result()
unsafe {
self.factory
.as_factory2()
.unwrap()
.create_swapchain_for_hwnd(
device.present_queue.as_mut_ptr() as *mut _,
hwnd,
&desc,
)
.into_result()
}
}
};

0 comments on commit 5cfeea5

Please sign in to comment.