Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. GPUDeviceLostInfo

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.

Instance properties

messageRead only

A string providing a human-readable message that explains why the device was lost.

reasonRead only

An enumerated value that defines the reason the device was lost in a machine-readable way.

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

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp