1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// SPDX-License-Identifier: MIT OR Apache-2.0
/// Identity of a compute backend. Used as a discriminant on error
/// variants, budget accounting, `GpuContext`, `SyncPoint`, etc.
///
/// `#[non_exhaustive]`, so adding a backend is not a breaking change.
#[non_exhaustive]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum BackendKind {
Cpu,
/// `wgpu::Device`-backed work submitted via `wgpu::Queue::submit`.
/// Emitted when the sync primitive is a `wgpu::SubmissionIndex` and
/// the producer does not expose a lower-level (Vulkan / D3D12 / Metal)
/// handle.
#[cfg(feature = "wgpu")]
Wgpu,
/// Native Vulkan submit — the producer holds a `VkDevice` and minted
/// a `VkSemaphore` directly (typically a timeline semaphore).
Vulkan,
/// Native D3D12 submit — `ID3D12CommandQueue::Signal` on an
/// `ID3D12Fence`.
D3D12,
/// Native D3D11 submit — `IDXGIKeyedMutex::AcquireSync` /
/// `ReleaseSync` on a shared texture.
D3D11,
/// Native Metal submit — `MTLCommandQueue::commandBuffer` followed by
/// `encodeSignalEvent` on an `MTLSharedEvent`.
Metal,
/// Native OpenGL — `glFenceSync` for a GL-only fence, or a GL
/// semaphore (`glGenSemaphoresEXT`) imported from a cross-API handle.
OpenGL,
#[cfg(feature = "opencl")]
OpenCl,
#[cfg(feature = "cuda")]
Cuda,
/// WebCodecs encode/decode target (browser). The caller consumes /
/// produces a `web_sys::VideoFrame` through a `VideoEncoder` /
/// `VideoDecoder`; as a shared-allocation target it selects the
/// OffscreenCanvas swapchain path. Gated on the `web-codecs` feature.
#[cfg(feature = "web-codecs")]
WebCodecs,
/// Android AHardwareBuffer export target. The
/// caller will consume an `AHardwareBuffer*` — NNAPI, foreign
/// Vulkan, cross-process IPC, etc.
#[cfg(target_os = "android")]
AHardwareBuffer,
/// App-window or MediaProjection VirtualDisplay presentation
/// surface.
#[cfg(target_os = "android")]
AndroidPresentation,
/// `ASurfaceControl` overlay layer.
#[cfg(target_os = "android")]
AndroidSurfaceControl,
/// `AImageWriter` feeding a foreign `ImageReader`.
#[cfg(target_os = "android")]
AImageWriter,
/// MediaCodec encoder input surface.
#[cfg(target_os = "android")]
MediaCodec,
/// Foreign GL ES context handoff.
#[cfg(target_os = "android")]
ForeignGl,
/// Foreign Vulkan device handoff.
#[cfg(target_os = "android")]
ForeignVulkan,
}