Skip to content

Commit 9c05f41

Browse files
committed
[d3d12 wgl] Upgrade to windows 0.59 crates
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.
1 parent 8c4aebc commit 9c05f41

File tree

10 files changed

+62
-90
lines changed

10 files changed

+62
-90
lines changed

.deny.toml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ skip = [
2222
# Deno uses an old version
2323
{ name = "which", version = "6.0.3" },
2424

25-
# Loom uses a new windows version
26-
{ name = "windows", version = "0.61.1" },
27-
{ name = "windows-core", version = "0.61.2" },
28-
{ name = "windows-implement", version = "0.60.0" },
29-
{ name = "windows-interface", version = "0.59.1" },
30-
{ name = "windows-result", version = "0.3.4" },
31-
{ name = "windows-strings", version = "0.4.2" },
25+
# Temporarily allow older Windows version until updates make it through
26+
{ name = "windows", version = "0.59" },
27+
{ name = "windows-core", version = "0.59" },
28+
{ name = "windows-implement", version = "0.59" },
29+
{ name = "windows-strings", version = "0.3" },
3230

3331
# cargo-metadata uses old version. Only used for infrastructure.
3432
{ name = "toml", version = "0.8.23" },
@@ -76,6 +74,3 @@ allow-git = [
7674
unknown-registry = "deny"
7775
unknown-git = "deny"
7876
required-git-spec = "rev"
79-
80-
[sources.allow-org]
81-
github = ["gfx-rs"]

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,7 @@ jobs:
746746
with:
747747
command: check advisories
748748
arguments: --all-features --workspace
749+
command-arguments: -Dwarnings
749750
rust-version: ${{ env.REPO_MSRV }}
750751

751752
cargo-deny-check-rest:

Cargo.lock

Lines changed: 27 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ indicatif = "0.18"
135135
itertools = { version = "0.14" }
136136
jobserver = "0.1"
137137
ktx2 = "0.4"
138-
libc = { version = "0.2.171", default-features = false }
138+
libc = { version = "0.2.172", default-features = false }
139139
# See https://github.com/rust-fuzz/libfuzzer/issues/126
140140
libfuzzer-sys = ">0.4.0,<=0.4.7"
141141
libloading = "0.8"
@@ -210,10 +210,10 @@ gpu-alloc = "0.6"
210210
gpu-descriptor = "0.3.2"
211211

212212
# DX12 dependencies
213-
gpu-allocator = { version = "0.27", default-features = false }
213+
gpu-allocator = { version = "0.28", default-features = false, features = ["hashbrown"] }
214214
range-alloc = "0.1"
215215
mach-dxcompiler-rs = { version = "0.1.4", default-features = false } # remember to increase max_shader_model if applicable
216-
windows-core = { version = "0.58", default-features = false }
216+
windows-core = { version = "0.59", default-features = false }
217217

218218
# Gles dependencies
219219
khronos-egl = "6"
@@ -223,7 +223,7 @@ glutin-winit = { version = "0.4", default-features = false }
223223
glutin_wgl_sys = "0.6"
224224

225225
# DX12 and GLES dependencies
226-
windows = { version = "0.58", default-features = false }
226+
windows = { version = "0.59", default-features = false }
227227

228228
# wasm32 dependencies
229229
console_error_panic_hook = "0.1.5"
@@ -245,7 +245,7 @@ deno_webidl = "0.214.0"
245245
deno_webgpu = { version = "0.181.0", path = "./deno_webgpu" }
246246
deno_unsync = "0.4.4"
247247
deno_error = "0.7.0"
248-
tokio = "1.45.1"
248+
tokio = "1.47"
249249
termcolor = "1.1.3"
250250

251251
# android dependencies

wgpu-hal/src/dx12/command.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
use alloc::vec::Vec;
22
use core::{mem, ops::Range};
33

4-
use windows::Win32::{
5-
Foundation,
6-
Graphics::{Direct3D12, Dxgi},
4+
use windows::{
5+
core::Interface as _,
6+
Win32::{
7+
Foundation,
8+
Graphics::{Direct3D12, Dxgi},
9+
},
710
};
8-
use windows_core::Interface;
911

1012
use super::conv;
1113
use crate::{
1214
auxil::{
1315
self,
14-
dxgi::{name::ObjectExt, result::HResult as _},
16+
dxgi::{name::ObjectExt as _, result::HResult as _},
1517
},
1618
dx12::borrow_interface_temporarily,
1719
AccelerationStructureEntries,
@@ -864,23 +866,12 @@ impl crate::CommandEncoder for super::CommandEncoder {
864866
if let Some(ds_view) = ds_view {
865867
if flags != Direct3D12::D3D12_CLEAR_FLAGS::default() {
866868
unsafe {
867-
// list.ClearDepthStencilView(
868-
// ds_view,
869-
// flags,
870-
// ds.clear_value.0,
871-
// ds.clear_value.1 as u8,
872-
// None,
873-
// )
874-
// TODO: Replace with the above in the next breaking windows-rs release,
875-
// when https://github.com/microsoft/win32metadata/pull/1971 is in.
876-
(Interface::vtable(list).ClearDepthStencilView)(
877-
Interface::as_raw(list),
869+
list.ClearDepthStencilView(
878870
ds_view,
879871
flags,
880872
ds.clear_value.0,
881873
ds.clear_value.1 as u8,
882-
0,
883-
core::ptr::null(),
874+
None,
884875
)
885876
}
886877
}

wgpu-hal/src/dx12/dcomp.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ use alloc::sync::Arc;
22
use core::{ffi, ptr};
33

44
use once_cell::sync::Lazy;
5-
use windows::Win32::{Foundation::HWND, Graphics::DirectComposition};
6-
use windows_core::Interface;
5+
use windows::{
6+
core::Interface as _,
7+
Win32::{Foundation::HWND, Graphics::DirectComposition},
8+
};
79

810
use super::DynLib;
911

wgpu-hal/src/dx12/device.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use super::{conv, descriptor, D3D12Lib};
2323
use crate::{
2424
auxil::{
2525
self,
26-
dxgi::{name::ObjectExt, result::HResult},
26+
dxgi::{name::ObjectExt as _, result::HResult as _},
2727
},
2828
dx12::{
2929
borrow_optional_interface_temporarily, shader_compilation, suballocation, DCompLib,

wgpu-hal/src/dx12/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ impl crate::Surface for Surface {
13301330
.ok_or(crate::SurfaceError::Other("IDXGIFactoryMedia not found"))?
13311331
.CreateSwapChainForCompositionSurfaceHandle(
13321332
&device.present_queue,
1333-
handle,
1333+
Some(handle),
13341334
&desc,
13351335
None,
13361336
)

wgpu-hal/src/dx12/suballocation.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
use alloc::sync::Arc;
2+
23
use gpu_allocator::{d3d12::AllocationCreateDesc, MemoryLocation};
34
use parking_lot::Mutex;
45
use windows::Win32::Graphics::{Direct3D12, Dxgi};
56

67
use crate::{
7-
auxil::dxgi::{name::ObjectExt, result::HResult as _},
8+
auxil::dxgi::{name::ObjectExt as _, result::HResult as _},
89
dx12::conv,
910
};
1011

@@ -143,7 +144,7 @@ impl Allocator {
143144
allocations,
144145
blocks,
145146
total_allocated_bytes: upstream.total_allocated_bytes,
146-
total_reserved_bytes: upstream.total_reserved_bytes,
147+
total_reserved_bytes: upstream.total_capacity_bytes,
147148
}
148149
}
149150
}

wgpu-hal/src/gles/wgl.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl WglContext {
128128
if unsafe { OpenGL::wglGetCurrentContext() }.is_invalid() {
129129
return Ok(());
130130
}
131-
unsafe { OpenGL::wglMakeCurrent(None, None) }
131+
unsafe { OpenGL::wglMakeCurrent(Default::default(), Default::default()) }
132132
}
133133
}
134134

@@ -382,7 +382,7 @@ fn create_instance_device() -> Result<InstanceDevice, crate::InstanceError> {
382382
1,
383383
None,
384384
None,
385-
instance,
385+
Some(instance.into()),
386386
None,
387387
)
388388
}
@@ -394,7 +394,7 @@ fn create_instance_device() -> Result<InstanceDevice, crate::InstanceError> {
394394
})?;
395395
let window = Window { window };
396396

397-
let dc = unsafe { Gdi::GetDC(window.window) };
397+
let dc = unsafe { Gdi::GetDC(Some(window.window)) };
398398
if dc.is_invalid() {
399399
return Err(crate::InstanceError::with_source(
400400
String::from("unable to create memory device"),
@@ -636,7 +636,7 @@ struct DeviceContextHandle {
636636
impl Drop for DeviceContextHandle {
637637
fn drop(&mut self) {
638638
unsafe {
639-
Gdi::ReleaseDC(self.window, self.device);
639+
Gdi::ReleaseDC(Some(self.window), self.device);
640640
};
641641
}
642642
}
@@ -672,7 +672,7 @@ impl Surface {
672672
) -> Result<(), crate::SurfaceError> {
673673
let swapchain = self.swapchain.read();
674674
let sc = swapchain.as_ref().unwrap();
675-
let dc = unsafe { Gdi::GetDC(self.window) };
675+
let dc = unsafe { Gdi::GetDC(Some(self.window)) };
676676
if dc.is_invalid() {
677677
log::error!(
678678
"unable to get the device context from window: {}",
@@ -750,7 +750,7 @@ impl crate::Surface for Surface {
750750
// Remove the old configuration.
751751
unsafe { self.unconfigure(device) };
752752

753-
let dc = unsafe { Gdi::GetDC(self.window) };
753+
let dc = unsafe { Gdi::GetDC(Some(self.window)) };
754754
if dc.is_invalid() {
755755
log::error!(
756756
"unable to get the device context from window: {}",

0 commit comments

Comments
 (0)