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

Pick supported adapter for examples #6522

Open
arjo129 opened this issue Nov 12, 2024 · 1 comment · May be fixed by #6557
Open

Pick supported adapter for examples #6522

arjo129 opened this issue Nov 12, 2024 · 1 comment · May be fixed by #6557

Comments

@arjo129
Copy link

arjo129 commented Nov 12, 2024

Description
On laptops with multiple graphics cards, when trying to run the raytracing examples I get the panic:

[2024-11-12T03:05:39Z WARN  winit::platform_impl::platform::x11::xdisplay] error setting XSETTINGS; Xft options won't reload automatically
[2024-11-12T03:05:39Z INFO  winit::platform_impl::platform::x11::window] Guessed window scale factor: 1.6666666666666667
[2024-11-12T03:05:39Z INFO  wgpu_examples::framework] Initializing wgpu...
[2024-11-12T03:05:40Z INFO  wgpu_core::instance] Adapter AdapterInfo { name: "AMD Radeon Graphics (RADV RENOIR)", vendor: 4098, device: 5688, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 24.0.9-0ubuntu0.1", backend: Vulkan }
[2024-11-12T03:05:40Z INFO  wgpu_examples::framework] Using AMD Radeon Graphics (RADV RENOIR) (Vulkan)
thread 'main' panicked at examples/src/framework.rs:291:9:
Adapter does not support required features for this example: Features(EXPERIMENTAL_RAY_TRACING_ACCELERATION_STRUCTURE | EXPERIMENTAL_RAY_QUERY)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Repro steps
Run the raytracing example on a laptop with an AMD integrated graphics card and a NVidia RTX card.

 cargo run --bin wgpu-examples ray_cube_compute

Expected vs observed behavior
Ideally, we should be able to select the right graphics card prior to instantiating a raytracing pipeline. I'd be open to helping push this along but have limited knowledge of wgpu.

Platform
Ubuntu 24.04 on a Razer Blade 14 AMD Ryzen 9 5900HX with RTX3060.

@teoxoy teoxoy changed the title Raytracing device enumeration Pick supported adapter for examples Nov 12, 2024
@teoxoy
Copy link
Member

teoxoy commented Nov 12, 2024

This code would have to be modified to enumerate all adapters and pick the one that satisfies the required features.

let adapter = wgpu::util::initialize_adapter_from_env_or_default(&instance, surface.get())
.await
.expect("No suitable GPU adapters found on the system!");
let adapter_info = adapter.get_info();
log::info!("Using {} ({:?})", adapter_info.name, adapter_info.backend);
let optional_features = E::optional_features();
let required_features = E::required_features();
let adapter_features = adapter.features();
assert!(
adapter_features.contains(required_features),
"Adapter does not support required features for this example: {:?}",
required_features - adapter_features
);

@arjo129 arjo129 linked a pull request Nov 16, 2024 that will close this issue
7 tasks
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.

2 participants