GPUDeviceLostInfo
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
Note: This feature is available inWeb Workers.
TheGPUDeviceLostInfo interface of theWebGPU API represents the object returned when theGPUDevice.lostPromise resolves. This provides information as to why a device has been lost.
See theGPUDevice.lost page for more information about "lost" state.
In this article
Instance properties
Examples
js
async function init() { if (!navigator.gpu) { throw Error("WebGPU not supported."); } const adapter = await navigator.gpu.requestAdapter(); if (!adapter) { throw Error("Couldn't request WebGPU adapter."); } // Create a GPUDevice let device = await adapter.requestDevice(descriptor); // Use lost to handle lost devices device.lost.then((info) => { console.error(`WebGPU device was lost: ${info.message}`); device = null; if (info.reason !== "destroyed") { init(); } }); // …}Specifications
| Specification |
|---|
| WebGPU> # gpudevicelostinfo> |
Browser compatibility
See also
- TheWebGPU API