mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
This is in preparation for making it a more substantial test stub, able to execute nontrivial code, and usable from the safe `wgpu` API.
30 lines
584 B
Rust
30 lines
584 B
Rust
use wgt::{Backend, WasmNotSendSync};
|
|
|
|
pub trait HalApi: hal::Api + 'static + WasmNotSendSync {
|
|
const VARIANT: Backend;
|
|
}
|
|
|
|
impl HalApi for hal::api::Noop {
|
|
const VARIANT: Backend = Backend::Noop;
|
|
}
|
|
|
|
#[cfg(vulkan)]
|
|
impl HalApi for hal::api::Vulkan {
|
|
const VARIANT: Backend = Backend::Vulkan;
|
|
}
|
|
|
|
#[cfg(metal)]
|
|
impl HalApi for hal::api::Metal {
|
|
const VARIANT: Backend = Backend::Metal;
|
|
}
|
|
|
|
#[cfg(dx12)]
|
|
impl HalApi for hal::api::Dx12 {
|
|
const VARIANT: Backend = Backend::Dx12;
|
|
}
|
|
|
|
#[cfg(gles)]
|
|
impl HalApi for hal::api::Gles {
|
|
const VARIANT: Backend = Backend::Gl;
|
|
}
|