Update WARP (#8444)

This commit is contained in:
Connor Fitzgerald 2025-11-04 23:57:49 -05:00 committed by GitHub
parent ccc650fd0a
commit 71b5fb0ad9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 36 additions and 26 deletions

View File

@ -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

View File

@ -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,

View File

@ -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<DCompLib>,
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<shader_compilation::CompilerContainer>,
options: wgt::Dx12BackendOptions,

View File

@ -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);