mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
29 lines
866 B
Rust
29 lines
866 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 {
|
|
power_preference: wgpu::PowerPreference::Default,
|
|
compatible_surface: None,
|
|
})
|
|
.await
|
|
.unwrap();
|
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
println!("{:?}", adapter.get_info())
|
|
}
|
|
|
|
fn main() {
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
{
|
|
env_logger::init();
|
|
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());
|
|
}
|
|
}
|