Skip to main content

all_backends

Function all_backends 

Source
pub fn all_backends(force_mock: bool) -> Vec<Box<dyn GpuBackend>>
Expand description

Explicit registry — no constructor/inventory magic. Each backend’s failed init is logged and skipped.

Registry order is load-bearing (design cross-platform.md §3.7/§9): nvidia → amd → intel → wddm → apple. The collector dedupes devices across backends by normalized PCI address, first backend wins — so NVML (the richer source) must register before wddm to claim NVIDIA boards, and AMD/Intel adapters — plus NVIDIA boards on driverless/broken-NVML machines — fall through to wddm. No new dedupe mechanism here: synthetic non-PCI ids (wddm:…, apple:…, mock:…) never dedupe by design — a double listing is visible and honest, a wrong merge is not.

force_mock returns ONLY the mock backend — its purpose is deterministic CI/demo output, so real devices must not leak in. Otherwise the mock is the fallback when no real backend initialized (so the TUI always has something to show, clearly labeled).