From c0015796ac2d04b1e8fc6f975614a566ff4de18e Mon Sep 17 00:00:00 2001 From: SupaMaggie70 Date: Sat, 3 Jan 2026 02:34:53 -0600 Subject: [PATCH 1/6] Will this fix? --- wgpu-hal/src/dx12/adapter.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/wgpu-hal/src/dx12/adapter.rs b/wgpu-hal/src/dx12/adapter.rs index 9d74e2e966..e00bcfcbf9 100644 --- a/wgpu-hal/src/dx12/adapter.rs +++ b/wgpu-hal/src/dx12/adapter.rs @@ -124,6 +124,7 @@ 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, + MaxSupportedFeatureLevel => return None, _ => unreachable!(), }; From ab2dceb3ad33d82b8433930bd597119623cbb50f Mon Sep 17 00:00:00 2001 From: SupaMaggie70 Date: Sat, 3 Jan 2026 02:39:18 -0600 Subject: [PATCH 2/6] Lmao I need to go to bed --- wgpu-hal/src/dx12/adapter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgpu-hal/src/dx12/adapter.rs b/wgpu-hal/src/dx12/adapter.rs index e00bcfcbf9..46d97783cc 100644 --- a/wgpu-hal/src/dx12/adapter.rs +++ b/wgpu-hal/src/dx12/adapter.rs @@ -124,7 +124,7 @@ 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, - MaxSupportedFeatureLevel => return None, + Default::default() => return None, _ => unreachable!(), }; From cfbffe2ab529f844ead57c0a82eb1e2f7339cd78 Mon Sep 17 00:00:00 2001 From: SupaMaggie70 Date: Sat, 3 Jan 2026 02:47:04 -0600 Subject: [PATCH 3/6] Maybe this'll work --- wgpu-hal/src/dx12/adapter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgpu-hal/src/dx12/adapter.rs b/wgpu-hal/src/dx12/adapter.rs index 46d97783cc..498c8d0d90 100644 --- a/wgpu-hal/src/dx12/adapter.rs +++ b/wgpu-hal/src/dx12/adapter.rs @@ -124,7 +124,7 @@ 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, - Default::default() => return None, + Direct3D::D3D_FEATURE_LEVEL(0) => return None, _ => unreachable!(), }; From f3a3a4614dfaf4f7e085744363d65e2c250ec596 Mon Sep 17 00:00:00 2001 From: SupaMaggie70 Date: Sat, 3 Jan 2026 03:19:56 -0600 Subject: [PATCH 4/6] Added changelog entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 880c8cf73a..61cad6f869 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 + +- Unreachable code entered during adapter enumeration on older DX12 environments that didn't support a high enough D3D12FeatureLevel was fixed. By @inner-daemons in [#8806](https://github.com/gfx-rs/wgpu/pull/8806). + ### Documentation #### General From 6f6371b7036dd1f483a3e135460134b642121ea4 Mon Sep 17 00:00:00 2001 From: Inner Daemons <85136135+inner-daemons@users.noreply.github.com> Date: Tue, 6 Jan 2026 17:23:18 -0600 Subject: [PATCH 5/6] Update CHANGELOG.md Co-authored-by: Erich Gubler --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61cad6f869..63f8b38d9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,7 +59,7 @@ Bottom level categories: #### DX12 -- Unreachable code entered during adapter enumeration on older DX12 environments that didn't support a high enough D3D12FeatureLevel was fixed. By @inner-daemons in [#8806](https://github.com/gfx-rs/wgpu/pull/8806). +- 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). ### Documentation From c655baf5e73cc3f6c373b2171d5001f829520c08 Mon Sep 17 00:00:00 2001 From: SupaMaggie70 Date: Tue, 6 Jan 2026 17:25:57 -0600 Subject: [PATCH 6/6] Added a comment and addressed Erich's suggestion --- wgpu-hal/src/dx12/adapter.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wgpu-hal/src/dx12/adapter.rs b/wgpu-hal/src/dx12/adapter.rs index 498c8d0d90..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,8 @@ 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!(), };