demo · v136

Library-side detect

The chromestatus motivation: libraries that take a user-provided GPUDevice need to know whether it's a fallback (software) adapter, but pre-136 the flag only existed on GPUAdapter, which the library doesn't see. v136 mirrors the flag onto GPUAdapterInfo — reachable from device.adapterInfo. This concept simulates the library entry point.

Probing WebGPU…
device.adapterInfo.vendor
device.adapterInfo.architecture
device.adapterInfo.isFallbackAdapter (136+)
library policy decision

the code

// Inside a library, given a GPUDevice you didn't allocate:
function setUp(device) {
  const info = device.adapterInfo;             // 136+: stable accessor
  if (info.isFallbackAdapter) {                // 136+: previously inaccessible
    // Skip the heavy compute path, fall back to a CPU implementation.
    return cpuPath();
  }
  return wgslPath(device);
}

why this angle

The sibling concept exposes the new attribute on a fresh adapter request. This concept demonstrates the actual deployment pattern: a library function that receives a pre-built device and now has a single, stable accessor to make the same fallback decision.

see also