Skip to content

Commit 1a023a9

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 2f890eb commit 1a023a9

File tree

7 files changed

+66
-31
lines changed

7 files changed

+66
-31
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pp-rs = "0.2.1"
165165
profiling = { version = "1", default-features = false }
166166
quote = "1.0.38"
167167
raw-window-handle = { version = "0.6.2", default-features = false }
168-
rwh_05 = { version = "0.5.2", package = "raw-window-handle" } # temporary compatibility for glutin-winit
168+
rwh_05 = { version = "0.5.2", package = "raw-window-handle" } # temporary compatibility for glutin-winit
169169
rayon = "1.3"
170170
regex-lite = "0.1"
171171
renderdoc-sys = "1"
@@ -209,7 +209,7 @@ gpu-descriptor = "0.3.2"
209209
gpu-allocator = { version = "0.27", default-features = false }
210210
range-alloc = "0.1"
211211
mach-dxcompiler-rs = { version = "0.1.4", default-features = false } # remember to increase max_shader_model if applicable
212-
windows-core = { version = "0.58", default-features = false }
212+
windows-core = { version = "0.59", default-features = false }
213213

214214
# Gles dependencies
215215
khronos-egl = "6"
@@ -219,7 +219,7 @@ glutin-winit = { version = "0.4", default-features = false }
219219
glutin_wgl_sys = "0.6"
220220

221221
# DX12 and GLES dependencies
222-
windows = { version = "0.58", default-features = false }
222+
windows = { version = "0.59", default-features = false }
223223

224224
# wasm32 dependencies
225225
console_error_panic_hook = "0.1.5"
@@ -250,6 +250,9 @@ ndk-sys = "0.6"
250250
[patch.crates-io]
251251
wgpu = { path = "./wgpu" }
252252

253+
# https://github.com/Traverse-Research/gpu-allocator/pull/258
254+
gpu-allocator = { git = "https://github.com/Traverse-Research/gpu-allocator", rev = "955b13a" }
255+
253256
[profile.release]
254257
lto = "thin"
255258
debug = true

wgpu-hal/src/dx12/command.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ use windows::Win32::{
55
Foundation,
66
Graphics::{Direct3D12, Dxgi},
77
};
8-
use windows_core::Interface;
8+
use windows_core::Interface as _;
99

1010
use super::conv;
1111
use crate::{
1212
auxil::{
1313
self,
14-
dxgi::{name::ObjectExt, result::HResult as _},
14+
dxgi::{name::ObjectExt as _, result::HResult as _},
1515
},
1616
dx12::borrow_interface_temporarily,
1717
AccelerationStructureEntries,
@@ -864,23 +864,12 @@ impl crate::CommandEncoder for super::CommandEncoder {
864864
if let Some(ds_view) = ds_view {
865865
if flags != Direct3D12::D3D12_CLEAR_FLAGS::default() {
866866
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),
867+
list.ClearDepthStencilView(
878868
ds_view,
879869
flags,
880870
ds.clear_value.0,
881871
ds.clear_value.1 as u8,
882-
0,
883-
core::ptr::null(),
872+
None,
884873
)
885874
}
886875
}

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,

wgpu-hal/src/dx12/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ impl crate::Surface for Surface {
12931293
.ok_or(crate::SurfaceError::Other("IDXGIFactoryMedia not found"))?
12941294
.CreateSwapChainForCompositionSurfaceHandle(
12951295
&device.present_queue,
1296-
handle,
1296+
Some(handle),
12971297
&desc,
12981298
None,
12991299
)

wgpu-hal/src/dx12/suballocation.rs

Lines changed: 2 additions & 1 deletion
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

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)