demo · v138
Adapter selection
Pre-138: adapter.isFallbackAdapter — one boolean, conflating “CPU fallback” with “integrated GPU” with “default discrete”. 138+: adapter.info.adapterType as a three-value enum that actually tells you what kind of device you got. Walk a real-world workload selection.
checking GPUAdapter info…
discrete
vendornvidia
deviceRTX 4070
type (138)"discrete-gpu"
isFallbackfalse
integrated
vendorintel
deviceIris Xe
type (138)"integrated-gpu"
isFallbackfalse
CPU fallback
vendor(software)
deviceSwiftShader
type (138)"cpu"
isFallbacktrue
awaiting selection…
the migration
// pre-138
const adapter = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" });
if (adapter.isFallbackAdapter) showWebGLFallback();
// 138+
const adapter = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" });
const t = adapter.info.adapterType; // "discrete-gpu" | "integrated-gpu" | "cpu"
if (t === "cpu") showWebGLFallback();
if (t === "integrated-gpu") shrinkTrainingBatch();
The deprecation isn’t cosmetic: the boolean lumped “CPU SwiftShader” with “low-power integrated GPU”. Apps that wanted to downscale on integrated had no signal; apps that wanted to fall back on CPU had a boolean that fired for cases it shouldn’t have. The enum splits them.