From 71b5fb0ad901416c1f02a298daa834898f80efd9 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Tue, 4 Nov 2025 23:57:49 -0500 Subject: [PATCH] Update WARP (#8444) --- .github/actions/install-warp/action.yml | 2 +- wgpu-hal/src/dx12/adapter.rs | 43 ++++++++++++++----------- wgpu-hal/src/dx12/mod.rs | 12 +++---- wgpu-hal/src/dx12/shader_compilation.rs | 5 +++ 4 files changed, 36 insertions(+), 26 deletions(-) diff --git a/.github/actions/install-warp/action.yml b/.github/actions/install-warp/action.yml index 66aa303ae..c3c1855d9 100644 --- a/.github/actions/install-warp/action.yml +++ b/.github/actions/install-warp/action.yml @@ -11,7 +11,7 @@ runs: run: | set -e - export WARP_VERSION="1.0.13" + export WARP_VERSION="1.0.16.1" # Make sure dxc is in path. dxc --version diff --git a/wgpu-hal/src/dx12/adapter.rs b/wgpu-hal/src/dx12/adapter.rs index c2a1df344..d19998ab7 100644 --- a/wgpu-hal/src/dx12/adapter.rs +++ b/wgpu-hal/src/dx12/adapter.rs @@ -116,8 +116,26 @@ impl super::Adapter { } .unwrap(); + let driver_version = unsafe { adapter.CheckInterfaceSupport(&Dxgi::IDXGIDevice::IID) } + .ok() + .map(|i| { + const MASK: i64 = 0xFFFF; + (i >> 48, (i >> 32) & MASK, (i >> 16) & MASK, i & MASK) + }) + .unwrap_or((0, 0, 0, 0)); + let mut workarounds = super::Workarounds::default(); + let is_warp = device_name.contains("Microsoft Basic Render Driver"); + + // WARP uses two different versioning schemes. Versions that ship with windows + // use a version that starts with 10.x.x.x. Versions that ship from Nuget use 1.0.x.x. + // + // As far as we know, this is only an issue on the Nuget versions. + if is_warp && driver_version >= (1, 0, 13, 0) && driver_version.0 < 10 { + workarounds.avoid_shader_debug_info = true; + } + let info = wgt::AdapterInfo { backend: wgt::Backend::Dx12, name: device_name, @@ -126,7 +144,6 @@ impl super::Adapter { device_type: if Dxgi::DXGI_ADAPTER_FLAG(desc.Flags as i32) .contains(Dxgi::DXGI_ADAPTER_FLAG_SOFTWARE) { - workarounds.avoid_cpu_descriptor_overwrites = true; wgt::DeviceType::Cpu } else if features_architecture.UMA.as_bool() { wgt::DeviceType::IntegratedGpu @@ -134,20 +151,10 @@ impl super::Adapter { wgt::DeviceType::DiscreteGpu }, device_pci_bus_id: get_adapter_pci_info(desc.VendorId, desc.DeviceId), - driver: { - if let Ok(i) = unsafe { adapter.CheckInterfaceSupport(&Dxgi::IDXGIDevice::IID) } { - const MASK: i64 = 0xFFFF; - format!( - "{}.{}.{}.{}", - i >> 48, - (i >> 32) & MASK, - (i >> 16) & MASK, - i & MASK - ) - } else { - String::new() - } - }, + driver: format!( + "{}.{}.{}.{}", + driver_version.0, driver_version.1, driver_version.2, driver_version.3 + ), driver_info: String::new(), transient_saves_memory: false, }; @@ -319,6 +326,7 @@ impl super::Adapter { }; let private_caps = super::PrivateCapabilities { instance_flags, + workarounds, heterogeneous_resource_heaps: options.ResourceHeapTier != Direct3D12::D3D12_RESOURCE_HEAP_TIER_1, memory_architecture: if features_architecture.UMA.as_bool() { @@ -532,8 +540,8 @@ impl super::Adapter { .is_ok(); // Once ray tracing pipelines are supported they also will go here - let supports_ray_tracing = features5.RaytracingTier - == Direct3D12::D3D12_RAYTRACING_TIER_1_1 + let supports_ray_tracing = features5.RaytracingTier.0 + >= Direct3D12::D3D12_RAYTRACING_TIER_1_1.0 && shader_model >= naga::back::hlsl::ShaderModel::V6_5 && has_features5; features.set( @@ -639,7 +647,6 @@ impl super::Adapter { dcomp_lib: Arc::clone(dcomp_lib), private_caps, presentation_timer, - workarounds, memory_budget_thresholds, compiler_container, options: backend_options, diff --git a/wgpu-hal/src/dx12/mod.rs b/wgpu-hal/src/dx12/mod.rs index 58544cab7..e82dc1283 100644 --- a/wgpu-hal/src/dx12/mod.rs +++ b/wgpu-hal/src/dx12/mod.rs @@ -597,6 +597,7 @@ enum MemoryArchitecture { #[derive(Debug, Clone, Copy)] struct PrivateCapabilities { instance_flags: wgt::InstanceFlags, + workarounds: Workarounds, #[allow(unused)] heterogeneous_resource_heaps: bool, memory_architecture: MemoryArchitecture, @@ -618,11 +619,11 @@ impl PrivateCapabilities { } } -#[derive(Default)] +#[derive(Default, Debug, Copy, Clone)] struct Workarounds { - // On WARP, temporary CPU descriptors are still used by the runtime - // after we call `CopyDescriptors`. - avoid_cpu_descriptor_overwrites: bool, + // On WARP 1.0.13+, debug information in shaders in certain situations causes the device + // to hang. https://github.com/gfx-rs/wgpu/issues/8368 + avoid_shader_debug_info: bool, } pub struct Adapter { @@ -632,9 +633,6 @@ pub struct Adapter { dcomp_lib: Arc, private_caps: PrivateCapabilities, presentation_timer: auxil::dxgi::time::PresentationTimer, - // Note: this isn't used right now, but we'll need it later. - #[allow(unused)] - workarounds: Workarounds, memory_budget_thresholds: wgt::MemoryBudgetThresholds, compiler_container: Arc, options: wgt::Dx12BackendOptions, diff --git a/wgpu-hal/src/dx12/shader_compilation.rs b/wgpu-hal/src/dx12/shader_compilation.rs index 7d6aaae61..341a86c30 100644 --- a/wgpu-hal/src/dx12/shader_compilation.rs +++ b/wgpu-hal/src/dx12/shader_compilation.rs @@ -396,6 +396,11 @@ fn compile_dxc( .private_caps .instance_flags .contains(wgt::InstanceFlags::DEBUG) + && !device + .shared + .private_caps + .workarounds + .avoid_shader_debug_info { compile_args.push(Dxc::DXC_ARG_DEBUG); compile_args.push(Dxc::DXC_ARG_SKIP_OPTIMIZATIONS);