Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::geode::GeodeDeviceLostState Struct Reference

Shared device-lost flag. More...

#include "donner/svg/renderer/geode/GeodeGpuWait.h"

Public Attributes

std::atomic< bool > lost {false}
 True once the device has been declared lost. Never reset. Publish it only through DeclareDeviceLost or DeclareDeviceLostAfterWaitTimeout, never by storing directly: the declaring call is what decides the attribution below, and a direct store silently opts out of that decision.
std::atomic< GpuWaitSitetimedOutSite {GpuWaitSite::None}
 Bounded wait that declared the loss, or None when the driver reported it. Only the call that wins the lost transition writes this, so an empty site is a positive statement ("no deadline expired first"), not an unwritten field.
std::atomic< int > timedOutElapsedMs {0}
 Wall time the timed-out wait spent before giving up, in milliseconds. Written before timedOutSite, which publishes it, so a reader that sees a site also sees that site's elapsed time. Zero while timedOutSite is None.

Detailed Description

Shared device-lost flag.

Set exactly once, from either direction, so a driver-reported device-loss callback and a bounded wait exceeding its deadline converge on one observable condition:

  • the WebGPU device-lost callback stores true when the driver reports a real loss, and
  • GeodeDevice::markDeviceLost stores true when a bounded GPU wait times out.

Held via shared_ptr by every party that needs to observe or publish the flag (the GeodeDevice, a host embedder's device-lost callback), because WebGPU callbacks can outlive the object that registered them.

Member Data Documentation

◆ lost

std::atomic<bool> donner::geode::GeodeDeviceLostState::lost {false}

True once the device has been declared lost. Never reset. Publish it only through DeclareDeviceLost or DeclareDeviceLostAfterWaitTimeout, never by storing directly: the declaring call is what decides the attribution below, and a direct store silently opts out of that decision.

◆ timedOutElapsedMs

std::atomic<int> donner::geode::GeodeDeviceLostState::timedOutElapsedMs {0}

Wall time the timed-out wait spent before giving up, in milliseconds. Written before timedOutSite, which publishes it, so a reader that sees a site also sees that site's elapsed time. Zero while timedOutSite is None.

◆ timedOutSite

std::atomic<GpuWaitSite> donner::geode::GeodeDeviceLostState::timedOutSite {GpuWaitSite::None}

Bounded wait that declared the loss, or None when the driver reported it. Only the call that wins the lost transition writes this, so an empty site is a positive statement ("no deadline expired first"), not an unwritten field.

Written just after lost, so a reader sampling between the two sees a lost device with an empty site for the width of two stores. That reads as a driver-reported loss, which is wrong but self-correcting: the site settles immediately and the next sample carries it. Consumers that publish this pair should therefore key on its value changing rather than latching the first sample they see.


The documentation for this struct was generated from the following file: