Skip to content

Commit

Permalink
[d3d12 wgl] Upgrade to windows 0.59 crates
Browse files Browse the repository at this point in the history
https://github.com/microsoft/windows-rs/releases/tag/0.61.0

The latest `windows 0.59` and `windows-core 0.59` crates were
just released (strangely tagged `0.61`), including some minor code
improvements for us.  The MSRV has been bumped to `1.74`, but `wgpu` is
already on `1.76` anyway.
  • Loading branch information
MarijnS95 committed Jan 8, 2025
1 parent a8a9173 commit d9cd506
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 44 deletions.
105 changes: 83 additions & 22 deletions Cargo.lock

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

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ bit-set = "0.8"
gpu-allocator = { version = "0.27", default-features = false }
range-alloc = "0.1"
mach-dxcompiler-rs = { version = "0.1.4", default-features = false }
windows-core = { version = "0.58", default-features = false }
windows-core = { version = "0.59", default-features = false }

# Gles dependencies
khronos-egl = "6"
Expand All @@ -168,7 +168,7 @@ glutin-winit = { version = "0.4", default-features = false }
glutin_wgl_sys = "0.6"

# DX and GLES dependencies
windows = { version = "0.58", default-features = false }
windows = { version = "0.59", default-features = false }

# wasm32 dependencies
console_error_panic_hook = "0.1.7"
Expand Down Expand Up @@ -207,6 +207,11 @@ ndk-sys = "0.5.0"
#js-sys = { path = "../wasm-bindgen/crates/js-sys" }
#wasm-bindgen = { path = "../wasm-bindgen" }

# https://github.com/Traverse-Research/gpu-allocator/pull/258
gpu-allocator = { git = "https://github.com/Traverse-Research/gpu-allocator", rev = "dd4ad67" }
# https://github.com/Xudong-Huang/generator-rs/pull/72
generator = { git = "https://github.com/MarijnS95/generator-rs", rev = "bb99244" }

[profile.release]
lto = "thin"
debug = true
Expand Down
15 changes: 2 additions & 13 deletions wgpu-hal/src/dx12/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,23 +768,12 @@ impl crate::CommandEncoder for super::CommandEncoder {
if let Some(ds_view) = ds_view {
if flags != Direct3D12::D3D12_CLEAR_FLAGS::default() {
unsafe {
// list.ClearDepthStencilView(
// ds_view,
// flags,
// ds.clear_value.0,
// ds.clear_value.1 as u8,
// None,
// )
// TODO: Replace with the above in the next breaking windows-rs release,
// when https://github.com/microsoft/win32metadata/pull/1971 is in.
(windows_core::Interface::vtable(list).ClearDepthStencilView)(
windows_core::Interface::as_raw(list),
list.ClearDepthStencilView(
ds_view,
flags,
ds.clear_value.0,
ds.clear_value.1 as u8,
0,
std::ptr::null(),
None,
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/dx12/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ impl crate::Surface for Surface {
.ok_or(crate::SurfaceError::Other("IDXGIFactoryMedia not found"))?
.CreateSwapChainForCompositionSurfaceHandle(
&device.present_queue,
handle,
Some(handle),
&desc,
None,
)
Expand Down
12 changes: 6 additions & 6 deletions wgpu-hal/src/gles/wgl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl WglContext {
if unsafe { OpenGL::wglGetCurrentContext() }.is_invalid() {
return Ok(());
}
unsafe { OpenGL::wglMakeCurrent(None, None) }
unsafe { OpenGL::wglMakeCurrent(Default::default(), Default::default()) }
}
}

Expand Down Expand Up @@ -380,7 +380,7 @@ fn create_instance_device() -> Result<InstanceDevice, crate::InstanceError> {
1,
None,
None,
instance,
Some(instance.into()),
None,
)
}
Expand All @@ -392,7 +392,7 @@ fn create_instance_device() -> Result<InstanceDevice, crate::InstanceError> {
})?;
let window = Window { window };

let dc = unsafe { Gdi::GetDC(window.window) };
let dc = unsafe { Gdi::GetDC(Some(window.window)) };
if dc.is_invalid() {
return Err(crate::InstanceError::with_source(
String::from("unable to create memory device"),
Expand Down Expand Up @@ -627,7 +627,7 @@ struct DeviceContextHandle {
impl Drop for DeviceContextHandle {
fn drop(&mut self) {
unsafe {
Gdi::ReleaseDC(self.window, self.device);
Gdi::ReleaseDC(Some(self.window), self.device);
};
}
}
Expand Down Expand Up @@ -663,7 +663,7 @@ impl Surface {
) -> Result<(), crate::SurfaceError> {
let swapchain = self.swapchain.read();
let sc = swapchain.as_ref().unwrap();
let dc = unsafe { Gdi::GetDC(self.window) };
let dc = unsafe { Gdi::GetDC(Some(self.window)) };
if dc.is_invalid() {
log::error!(
"unable to get the device context from window: {}",
Expand Down Expand Up @@ -741,7 +741,7 @@ impl crate::Surface for Surface {
// Remove the old configuration.
unsafe { self.unconfigure(device) };

let dc = unsafe { Gdi::GetDC(self.window) };
let dc = unsafe { Gdi::GetDC(Some(self.window)) };
if dc.is_invalid() {
log::error!(
"unable to get the device context from window: {}",
Expand Down

0 comments on commit d9cd506

Please sign in to comment.