mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
`BackendBit::all()` allows GL/surfman to be used on macOS which appears to prevent rendering with Metal (e.g. hello-triangle displays an empty window). surfman will be removed in later versions of gfx, which will allow us to switch back to `BackendBit::all()` in the examples.
26 lines
794 B
Rust
26 lines
794 B
Rust
/// This example shows how to describe the adapter in use.
|
|
async fn run() {
|
|
#[cfg_attr(target_arch = "wasm32", allow(unused_variables))]
|
|
let adapter = wgpu::Instance::new(wgpu::BackendBit::PRIMARY)
|
|
.request_adapter(&wgpu::RequestAdapterOptions::default())
|
|
.await
|
|
.unwrap();
|
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
println!("{:?}", adapter.get_info())
|
|
}
|
|
|
|
fn main() {
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
{
|
|
subscriber::initialize_default_subscriber(None);
|
|
futures::executor::block_on(run());
|
|
}
|
|
#[cfg(target_arch = "wasm32")]
|
|
{
|
|
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
|
|
console_log::init().expect("could not initialize logger");
|
|
wasm_bindgen_futures::spawn_local(run());
|
|
}
|
|
}
|