Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX12 adapter does not support surface when multiple backends are specified in the instance #5324

Closed
ItsSunnyMonster opened this issue Mar 1, 2024 · 4 comments · Fixed by #5535
Milestone

Comments

@ItsSunnyMonster
Copy link

ItsSunnyMonster commented Mar 1, 2024

Description
When I create my instance with default options or something that specifies more than one backend such as Backends::PRIMARY the surface (a default window created with winit) would not be compatible with any one of the DX12 adapters returned by enumerate_adapters. Instead, if I created the instance specifying DX12 backend in the options, DX12 adapters work fine.

Repro steps
A minimal example can be found at https://github.com/ItsSunnyMonster/wgpu_crash_minimal

Expected vs observed behavior
The returned adapters should have the same behaviour regardless of what backends were specified when creating the instance.

Platform
OS: Windows 10 22H2 build 19045.4046 (Reproducible on Windows 11 and presumably other versions of windows)
GPU: AMD Radeon Vega 8 Graphics (Reproducible on machines with a discrete GPU, tested on NVidia RTX 4060 and NVidia Quadro P2200)
wgpu version: 0.19.1

@teoxoy
Copy link
Member

teoxoy commented Mar 11, 2024

@Wumpf could this be related to #4984?

@Wumpf
Copy link
Member

Wumpf commented Mar 11, 2024

very likely, yes. Would be interesting if this regressed.
I'll pin this for myself to have a look soonish.

@Gordon-F
Copy link
Contributor

Gordon-F commented Mar 11, 2024

@ItsSunnyMonster I guess it's because your instance created with Vulkan backend if you enable Backends::PRIMARY. See my comment here - #2384 (comment)

Both Instance and Surface in wgpu are for all of the active backends, simlultaneously

@ItsSunnyMonster
Copy link
Author

Thank you all for responding! So, if I understand correctly, a temporary fix to this problem right now is:

  1. Create an instance with all desired backends
  2. Select the best adapter
  3. Recreate the instance with the backend of the selected adapter
  4. Enumerate the adapters again and reselect it (If I used the adapter selected before the instance is recreated and used the new instance to create the surface, Surface::get_capabilities panics with "Invalid Adapter")

Is that correct? Are there any better workarounds?

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 a pull request may close this issue.

5 participants