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 Feb 8, 2025
1 parent 6558deb commit 77cef5a
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 54 deletions.
113 changes: 87 additions & 26 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 @@ gpu-descriptor = "0.3"
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"

# DX12 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 @@ -197,6 +197,11 @@ ndk-sys = "0.5.0"
[patch.crates-io]
wgpu = { path = "./wgpu" }

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

[profile.release]
lto = "thin"
debug = true
Expand Down
29 changes: 10 additions & 19 deletions wgpu-hal/src/dx12/command.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
use std::{mem, ops::Range};

use windows::Win32::{
Foundation,
Graphics::{Direct3D12, Dxgi},
};
use windows_core::Interface as _;

use super::conv;
use crate::{
auxil::{self, dxgi::result::HResult as _},
dx12::borrow_interface_temporarily,
AccelerationStructureEntries,
};
use std::{mem, ops::Range};
use windows::Win32::{
Foundation,
Graphics::{Direct3D12, Dxgi},
};
use windows_core::Interface;

fn make_box(origin: &wgt::Origin3d, size: &crate::CopyExtent) -> Direct3D12::D3D12_BOX {
Direct3D12::D3D12_BOX {
Expand Down Expand Up @@ -792,23 +794,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.
(Interface::vtable(list).ClearDepthStencilView)(
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 @@ -1221,7 +1221,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
Loading

0 comments on commit 77cef5a

Please sign in to comment.