diff --git a/CHANGELOG.md b/CHANGELOG.md index e3a0b25ee9..c2a7114049 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,10 @@ Bottom level categories: - `DisplayHandle` should now be passed to `InstanceDescriptor` for correct EGL initialization on Wayland. By @MarijnS95 in [#8012](https://github.com/gfx-rs/wgpu/pull/8012) Note that the existing workaround to create surfaces before the adapter is no longer valid. +#### DX12 + +- Don't panic in adapter enumeration on older DX12 environments that don't support a high enough `D3D12FeatureLevel`. By @inner-daemons in [#8806](https://github.com/gfx-rs/wgpu/pull/8806). + #### naga - Reject zero-value construction of a runtime-sized array with a validation error. Previously it would crash in the HLSL backend. By @mooori in [#8741](https://github.com/gfx-rs/wgpu/pull/8741). diff --git a/wgpu-hal/src/dx12/adapter.rs b/wgpu-hal/src/dx12/adapter.rs index 9d74e2e966..35303d00fc 100644 --- a/wgpu-hal/src/dx12/adapter.rs +++ b/wgpu-hal/src/dx12/adapter.rs @@ -108,7 +108,7 @@ impl super::Adapter { let mut device_levels = Direct3D12::D3D12_FEATURE_DATA_FEATURE_LEVELS { NumFeatureLevels: d3d_feature_level.len() as u32, pFeatureLevelsRequested: d3d_feature_level.as_ptr().cast(), - MaxSupportedFeatureLevel: Default::default(), + MaxSupportedFeatureLevel: Direct3D::D3D_FEATURE_LEVEL(0), }; unsafe { device.CheckFeatureSupport( @@ -124,6 +124,9 @@ impl super::Adapter { Direct3D::D3D_FEATURE_LEVEL_12_0 => FeatureLevel::_12_0, Direct3D::D3D_FEATURE_LEVEL_12_1 => FeatureLevel::_12_1, Direct3D::D3D_FEATURE_LEVEL_12_2 => FeatureLevel::_12_2, + // Some older windows versions will leave the max feature level unset + // without returning an error if the feature level isn't supported. + Direct3D::D3D_FEATURE_LEVEL(0) => return None, _ => unreachable!(), };