Skip to content

[d3d12 wgl] Upgrade to windows 0.61 crates #8013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 21 additions & 85 deletions Cargo.lock

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

14 changes: 9 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pp-rs = "0.2.1"
profiling = { version = "1.0.1", default-features = false }
quote = "1.0.38"
raw-window-handle = { version = "0.6.2", default-features = false }
rwh_05 = { version = "0.5.2", package = "raw-window-handle" } # temporary compatibility for glutin-winit
rwh_05 = { version = "0.5.2", package = "raw-window-handle" } # temporary compatibility for glutin-winit
rayon = "1.3"
regex-lite = "0.1"
renderdoc-sys = "1"
Expand Down Expand Up @@ -206,10 +206,10 @@ gpu-alloc = "0.6"
gpu-descriptor = "0.3.2"

# DX12 dependencies
gpu-allocator = { version = "0.27", default-features = false }
gpu-allocator = { version = "0.27", default-features = false, features = ["hashbrown"] }
range-alloc = "0.1"
mach-dxcompiler-rs = { version = "0.1.4", default-features = false } # remember to increase max_shader_model if applicable
windows-core = { version = "0.58", default-features = false }
windows-core = { version = "0.61", default-features = false }

# Gles dependencies
khronos-egl = "6"
Expand All @@ -219,7 +219,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.61", default-features = false }

# wasm32 dependencies
console_error_panic_hook = "0.1.5"
Expand All @@ -240,7 +240,7 @@ deno_webidl = "0.192.0"
deno_webgpu = { version = "0.157.0", path = "./deno_webgpu" }
deno_unsync = "0.4.2"
deno_error = "0.5.5"
tokio = "1.39"
tokio = "1.47"
termcolor = "1.1.3"

# android dependencies
Expand All @@ -250,6 +250,10 @@ ndk-sys = "0.6"
[patch.crates-io]
wgpu = { path = "./wgpu" }

# https://github.com/Traverse-Research/gpu-allocator/pull/258
# https://github.com/Traverse-Research/gpu-allocator/pull/269
gpu-allocator = { git = "https://github.com/Traverse-Research/gpu-allocator", rev = "673e4ecb503af4188e0ca576acd0dad681f22413" }

[profile.release]
lto = "thin"
debug = true
Expand Down
19 changes: 4 additions & 15 deletions wgpu-hal/src/dx12/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use windows::Win32::{
Foundation,
Graphics::{Direct3D12, Dxgi},
};
use windows_core::Interface;
use windows_core::Interface as _;

use super::conv;
use crate::{
auxil::{
self,
dxgi::{name::ObjectExt, result::HResult as _},
dxgi::{name::ObjectExt as _, result::HResult as _},
},
dx12::borrow_interface_temporarily,
AccelerationStructureEntries,
Expand Down Expand Up @@ -864,23 +864,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,
core::ptr::null(),
None,
)
}
}
Expand Down
8 changes: 4 additions & 4 deletions wgpu-hal/src/dx12/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use super::{conv, descriptor, D3D12Lib};
use crate::{
auxil::{
self,
dxgi::{name::ObjectExt, result::HResult},
dxgi::{name::ObjectExt as _, result::HResult as _},
},
dx12::{
borrow_optional_interface_temporarily, shader_compilation, suballocation,
Expand Down Expand Up @@ -1826,8 +1826,8 @@ impl crate::Device for super::Device {
DepthBias: bias.constant,
DepthBiasClamp: bias.clamp,
SlopeScaledDepthBias: bias.slope_scale,
DepthClipEnable: Foundation::BOOL::from(!desc.primitive.unclipped_depth),
MultisampleEnable: Foundation::BOOL::from(desc.multisample.count > 1),
DepthClipEnable: windows_core::BOOL::from(!desc.primitive.unclipped_depth),
MultisampleEnable: windows_core::BOOL::from(desc.multisample.count > 1),
ForcedSampleCount: 0,
AntialiasedLineEnable: false.into(),
ConservativeRaster: if desc.primitive.conservative {
Expand Down Expand Up @@ -1857,7 +1857,7 @@ impl crate::Device for super::Device {
RasterizedStream: 0,
},
BlendState: Direct3D12::D3D12_BLEND_DESC {
AlphaToCoverageEnable: Foundation::BOOL::from(
AlphaToCoverageEnable: windows_core::BOOL::from(
desc.multisample.alpha_to_coverage_enabled,
),
IndependentBlendEnable: true.into(),
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 @@ -1295,7 +1295,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
5 changes: 3 additions & 2 deletions wgpu-hal/src/dx12/suballocation.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use alloc::sync::Arc;

use gpu_allocator::{d3d12::AllocationCreateDesc, MemoryLocation};
use parking_lot::Mutex;
use windows::Win32::Graphics::{Direct3D12, Dxgi};

use crate::{
auxil::dxgi::{name::ObjectExt, result::HResult as _},
auxil::dxgi::{name::ObjectExt as _, result::HResult as _},
dx12::conv,
};

Expand Down Expand Up @@ -143,7 +144,7 @@ impl Allocator {
allocations,
blocks,
total_allocated_bytes: upstream.total_allocated_bytes,
total_reserved_bytes: upstream.total_reserved_bytes,
total_reserved_bytes: upstream.total_capacity_bytes,
}
}
}
Expand Down
Loading
Loading