Skip to content

Conversation

@inner-daemons
Copy link
Collaborator

@inner-daemons inner-daemons commented Jan 3, 2026

Connections
Closes #8803

Description
Fixes issue with device not supporting our required D3D12 feature level, and us entering unreachable code. This is an issue for mozilla.

Testing
Hasn't been, @ErichDonGubler can you verify that this should fix it?

Squash or Rebase?
Squash due to only commit being named stupid

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

Copy link
Member

@ErichDonGubler ErichDonGubler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super minor changes requested. Otherwise, thanks for taking this on! 🙂

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,
Direct3D::D3D_FEATURE_LEVEL(0) => return None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue(non-blocking): I suspect we'll also want to report this via telemetry. That sound interesting, @teoxoy?

Copy link
Collaborator Author

@inner-daemons inner-daemons Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt this will be worth reporting given my comment below. Also completely out of my domain of expertise lol. Seems to be an issue with some windows versions that is easily bypassed.

I'll leave this unresolved for visibility

@ErichDonGubler ErichDonGubler changed the title Fix #8803 [dx12] Don't panic if MaxSupportedFeatureLevel wasn't set by query Jan 3, 2026
@ErichDonGubler
Copy link
Member

ErichDonGubler commented Jan 3, 2026

In the OP:

This is an issue for mozilla.

This is an issue for everyone trying to use wgpu on native, Mozilla is just the first to discover it. 😉

@ErichDonGubler
Copy link
Member

Hasn't been, @ErichDonGubler can you verify that this should fix it?

We don't have 100% certainty that the case we're trying to handle is the actual behavior causing crashes here (viz., we're not sure that 0 is actually the value remaining in MaxSupportFeatureLevel). I believe this is the case, but it would be best if we could find a way to reproduce this before merging.

@inner-daemons
Copy link
Collaborator Author

@ErichDonGubler I asked in the directx discord. I'm told that what we're seeing "shouldnt be possible" but also isn't a driver bug; the person is responding with single sentences and I can't figure out what they mean. Once I get feedback I'll also document that here in a comment.

@ErichDonGubler
Copy link
Member

ErichDonGubler commented Jan 3, 2026

Inlining my notes from bug 2007754, comment 7:

I just tested on a Windows machine of mine that doesn't support Direct3D::D3D_FEATURE_LEVEL_12_2 by commenting all but the Direct3D::D3D_FEATURE_LEVEL_12_2 member of the d3d_feature_level array … . In that case, CheckFeatureSupport does return an E_INVALIDARG. 🫠 … I wonder if this is a bug … that got fixed in newer versions of DX12 than what user machines currently have?

ETA: For reference, that's this commit stack: https://github.com/gfx-rs/wgpu/compare/aba9161b72c028aa8a1ce15aabd92e3c3cdb2da3..6fe22a0b59f256648eedd7652247c23490162d1a

@jimblandy
Copy link
Member

Hasn't been, @ErichDonGubler can you verify that this should fix it?

We don't have 100% certainty that the case we're trying to handle is the actual behavior causing crashes here (viz., we're not sure that 0 is actually the value remaining in MaxSupportFeatureLevel). I believe this is the case, but it would be best if we could find a way to reproduce this before merging.

@ErichDonGubler So, were you able to get a crash locally with the test case in #8803? Does this PR fix that crash?

@inner-daemons
Copy link
Collaborator Author

inner-daemons commented Jan 6, 2026

Also, I will update this with information from the DX12 discord server:

This is a bug in Microsoft's DirectX code on older Windows versions. The fix is just as I did it here, and some sample code shared by several users had basically identical code to what we would have after this lands.

I'd still like confirmation that this actually fixes the bug but I'd be very surprised if it didn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DX12 fails to populate MaxSupportedFeatureLevel on specific (older?) environments

3 participants