Skip to content

Commit

Permalink
Check for required wgpu features (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc authored Oct 25, 2023
1 parent d9e9e6a commit d07179d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions vger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,23 @@ impl VgerRenderer {
compatible_surface: Some(&surface),
force_fallback_adapter: false,
}))
.ok_or_else(|| anyhow::anyhow!("can't get adaptor"))?;
.ok_or_else(|| anyhow::anyhow!("can't get adapter"))?;

if adapter.get_info().device_type == DeviceType::Cpu {
return Err(anyhow::anyhow!("only cpu adaptor found"));
return Err(anyhow::anyhow!("only cpu adapter found"));
}

let mut required_downlevel_flags = wgpu::DownlevelFlags::empty();
required_downlevel_flags.set(wgpu::DownlevelFlags::VERTEX_STORAGE, true);

if !adapter
.get_downlevel_capabilities()
.flags
.contains(required_downlevel_flags)
{
return Err(anyhow::anyhow!(
"adapter doesn't support required downlevel flags"
));
}

let (device, queue) = futures::executor::block_on(adapter.request_device(
Expand Down

0 comments on commit d07179d

Please sign in to comment.