Luxar Viewer API Documentation - v2026.10.22
    Preparing search index...

    Module scene/scene-manager/render-pipeline/webgpu-device-recovery

    WebGPU device-loss recovery, the counterpart of webgl-context-recovery.ts.

    three's WebGPURenderer does NOT recreate a lost device: its backend calls renderer.onDeviceLost, which only logs and latches _isDeviceLost, after which every render returns early. So recovery here means building a NEW renderer on the same canvas (the host's recreateRenderer) and handing it to everything that renders (post-processing, environment, picking), then re-uploading the geometry from its CPU mirrors, exactly as a WebGL context restore does.

    Sequence:

    • Loss: the current device's lost promise resolves. A 'destroyed' reason means the device was explicitly destroyed and is not a recoverable loss. Otherwise flip isLost, tell the host (onLost: event, toast, smaller GPU budget), and start recovery.
    • Recovery: recreateRenderer() builds a renderer on a fresh device and rewires the host. Success re-arms the observer on the new device and calls onRestored. A failure is retried once after retryDelayMs; a second failure ends in onUnrecoverable (the reload prompt).

    A device that is lost again after a successful recovery starts the cycle afresh: the attempt budget is per loss, not per session.

    WebGPUDeviceRecovery
    DeviceLostInfo
    GpuDeviceLike
    WebGPUDeviceRecoveryDeps