Commit Graph
5 Commits
Author SHA1 Message Date
dotCooCoo 03ec8838b6 craft-gpu-device: polls run after an out-of-memory error, and faults keep their cause
After an out-of-memory error, `poll`, `wait` and the bounded waits still
run, so staging memory is reclaimed. `clear_out_of_memory` takes the count
from `out_of_memory_count` and clears only the errors seen up to it, so an
error that arrives while memory is freed stays recorded. A loss or another
error still stops polls and waits, also when an out-of-memory error
follows it.

A fault's text now holds wgpu's heading and each cause on one line, for
example "Validation Error: In Queue::submit: Buffer 'pc' has been
destroyed", instead of only "Validation Error". The text is built up to
200 characters without joining the whole message first.

`wait_slices` takes the elapsed time from a closure. The wait uses the
system clock, and the tests use a clock that does not move or one that
advances by each slice, so their results do not depend on scheduling.
2026-11-18 13:43:25 -08:00
dotCooCoo 383ae5d15b craft-gpu-device: pick returns OpenError, and the docs describe the web path
pick now returns OpenError instead of a String, so a caller can tell
UnsafeDriver from NoAdapter. With no usable adapter it logs the listed
adapters and returns NoAdapter. egui-wgpu's selector takes a String, so
that caller converts with map_err(|e| e.to_string()).

The crate docs and README now say what applies in a browser: WebGPU
lists only the adapter the browser offers, a web build requests it with
Preference::power(), and Capabilities, Recovery and DeviceHealth (apart
from its blocking waits) work there.
2026-11-17 17:47:09 -08:00
dotCooCoo 50b82932ca craft-gpu-device: Software draws with the newest version of a driver listed twice
Preference::Software took the first usable software entry without the
correction Auto, LowPower and Adapter apply. When one driver listed a
software adapter twice, a stale version could be chosen, and the fallback
order then left the newer one out. Every preference now goes through the
same correction.
2026-11-17 13:33:20 -08:00
dotCooCoo 5c4c73f4a9 craft-gpu-device: bounded waits keep one target, and a label cannot mark a loss
- wait_timeout and wait_timeout_cancelable take a submission index
  instead of an Option. Every 100 ms slice waits for that index, so
  work submitted during the wait no longer moves the target and can no
  longer make a healthy device time out. Pass queue.submit([]) to wait
  for everything submitted so far.
- An uncaptured error counts as a device loss only when an error in
  its source chain is wgpu's "Parent device is lost". A resource label
  that contains those words, on its own line or not, is recorded as an
  error.
2026-11-17 11:06:59 -08:00
dotCooCoo a7d402ff95 craft-gpu-device: choose and open a wgpu device
Adds the adapter preference (Auto, low power, a named adapter, software)
with a key that survives a reordered adapter list and a driver update,
wgpu's adapter rule with corrections for drivers that crash, a ranked
fallback order ending in a software adapter, a capability report, and
device health that records a loss or an uncaptured error without a lock.
2026-11-17 10:34:35 -08:00