|
1 | 1 | fn main() {
|
2 | 2 | cfg_aliases::cfg_aliases! {
|
3 | 3 | native: { not(target_arch = "wasm32") },
|
4 |
| - webgl: { all(target_arch = "wasm32", not(target_os = "emscripten"), feature = "webgl") }, |
5 |
| - webgpu: { all(target_arch = "wasm32", not(target_os = "emscripten"), feature = "webgpu") }, |
6 | 4 | Emscripten: { all(target_arch = "wasm32", target_os = "emscripten") },
|
7 |
| - wgpu_core: { any(native, webgl, Emscripten) }, |
| 5 | + |
8 | 6 | send_sync: { any(
|
9 |
| - not(target_arch = "wasm32"), |
| 7 | + native, |
10 | 8 | all(feature = "fragile-send-sync-non-atomic-wasm", not(target_feature = "atomics"))
|
11 | 9 | ) },
|
| 10 | + |
| 11 | + // Backends - keep this in sync with `wgpu-core/Cargo.toml` & docs in `wgpu/Cargo.toml` |
| 12 | + webgpu: { all(not(native), not(Emscripten), feature = "webgpu") }, |
| 13 | + webgl: { all(not(native), not(Emscripten), feature = "webgl") }, |
12 | 14 | dx12: { all(target_os = "windows", feature = "dx12") },
|
13 | 15 | metal: { all(target_vendor = "apple", feature = "metal") },
|
| 16 | + vulkan: { any( |
| 17 | + // The `vulkan` feature enables the Vulkan backend only on "native Vulkan" platforms, i.e. Windows/Linux/Android |
| 18 | + all(any(windows, target_os = "linux", target_os = "android"), feature = "vulkan"), |
| 19 | + // On Apple platforms, however, we require the `vulkan-portability` feature |
| 20 | + // to explicitly opt-in to Vulkan since it's meant to be used with MoltenVK. |
| 21 | + all(target_vendor = "apple", feature = "vulkan-portability") |
| 22 | + ) }, |
| 23 | + gles: { any( |
| 24 | + // The `gles` feature enables the OpenGL/GLES backend only on "native OpenGL" platforms, i.e. Windows, Linux, Android, and Emscripten. |
| 25 | + // (Note that WebGL is also not included here!) |
| 26 | + all(any(windows, target_os = "linux", target_os = "android", Emscripten), feature = "gles"), |
| 27 | + // On Apple platforms, however, we require the `angle` feature to explicitly opt-in to OpenGL |
| 28 | + // since its meant to be used with ANGLE. |
| 29 | + all(target_vendor = "apple", feature = "angle") |
| 30 | + ) }, |
| 31 | + noop: { feature = "noop" }, |
| 32 | + |
| 33 | + wgpu_core: { |
| 34 | + any( |
| 35 | + // On native, wgpu_core is currently always enabled, even if there's no backend enabled at all. |
| 36 | + native, |
| 37 | + // `wgpu_core` is implied if any backend other than WebGPU is enabled. |
| 38 | + // (this is redundant except for `gles` and `noop`) |
| 39 | + webgl, dx12, metal, vulkan, gles, noop |
| 40 | + ) |
| 41 | + }, |
| 42 | + |
14 | 43 | // This alias is _only_ if _we_ need naga in the wrapper. wgpu-core provides
|
15 | 44 | // its own re-export of naga, which can be used in other situations
|
16 | 45 | naga: { any(feature = "naga-ir", feature = "spirv", feature = "glsl") },
|
|
0 commit comments