Commit Graph
14 Commits
Author SHA1 Message Date
dotCooCoo 272e4685bf gpu-device: share the native wgpu instance 2026-11-26 17:31:23 -08:00
dotCooCoo 6195baabe6 gpu-device: stop linking private items from choose's documentation 2026-11-26 00:00:47 -08:00
dotCooCoo 8bd8f865ff craft-gpu-device: try wgpu's fallback adapter after a listed software adapter fails
open_async skipped the fallback request once any software adapter had
been tried, even when wgpu's fallback adapter was a different one. It
now skips only an adapter the ranked loop already tried.
2026-11-25 19:33:43 -08:00
dotCooCoo 840e2657d3 craft-gpu-device: test that an adapter below the requested limits is skipped
request_device returns an error for limits above the adapter's, and open reports that adapter as DeviceFailed and tries the next one. A test now covers it, and the docs say so.
2026-11-20 15:14:35 -08:00
dotCooCoo 8fd418260e craft-gpu-device: end an unbounded wait on a fault another clone records
DeviceHealth::wait polls in slices of at most 100 ms and checks the
health between them, so a loss or an error other than out of memory
recorded elsewhere while the work has not finished ends the wait instead
of leaving it blocked. It takes a submission index, as wait_timeout
does, so work submitted during the wait does not extend it. The README
step that lists what to build again after a loss no longer repeats a
phrase.
2026-11-20 14:44:29 -08:00
dotCooCoo f3958d58c6 craft-gpu-device: drop the no-software notice when a software device opens
wgpu's fallback adapter can open a software device that the listing did not
show. The notice that no software adapter was listed no longer stays on the
returned Opened in that case.
2026-11-20 11:31:36 -08:00
dotCooCoo 928692ebfd craft-gpu-device: keep the choice off avoided entries, stop waits on a recorded fault
- choose and a named or software preference follow the newest-version
  correction until the entry is its own newest version. An entry without
  a bus id between two cards of one model no longer leaves the choice on
  an entry that avoided() excludes. The host test accepts every safe
  fallback, and None only when the Intel Vulkan entry is all there is.
- An optional experimental feature is no longer requested, so the device
  opens without it instead of failing the adapter.
- A bounded wait stops after the current slice once another clone records
  a loss or an error other than out of memory.
- Both loss writers record the loss before setting device_lost.
- Docs: recovery starts on device_status; the software notice shows only
  when a software adapter opened; surfaces are configured from the new
  adapter's capabilities; GPUInternalError on the browser backend panics
  in wgpu 30 before the handler runs; late completion counts as Finished.
2026-11-20 11:15:59 -08:00
dotCooCoo c18e5240d1 craft-gpu-device: read capabilities from DeviceCaps, open from async code
- craft-gpu's DeviceCaps gains `vendor_id` and `software` (serde
  default 0 and false) and `has_feature`. craft-gpu-wgpu fills both.
- `Capabilities` holds a DeviceCaps and reads NV12, P010, 16-bit norm,
  f16 and timestamps from its feature names and the vendor from its
  vendor id. It derefs to DeviceCaps and converts both ways.
- `list_async` and `open_async` are `list` and `open` as futures, for a
  wasm32 web worker. In a browser they request the adapter for the
  preference's power; wgpu 30 does not pass the fallback-adapter option
  to the browser, so `Software` there opens the browser's adapter.
- The README lists what a caller rebuilds after a device loss.
2026-11-20 10:13:54 -08:00
dotCooCoo 99b402b29f craft-gpu-device: report caps and device loss in craft-gpu's types
- device_caps (and Opened::device_caps) gives a device's
  craft_gpu::DeviceCaps: the limits and enabled feature names the
  device was opened with, in the form craft-gpu-wgpu reports.
- DeviceHealth::device_status reports a recorded loss as
  GpuFault::DeviceLost, in the form of GpuContext::device_status, and a
  Fault converts to a GpuFault (a loss to DeviceLost, an error to
  Operation).
- wgpu keeps one device-lost callback per device, so a craft-gpu
  context on a device DeviceHealth::watch watches reads the loss from
  device_status instead of setting its own callback. The README says so.
- pollster comes from the workspace dependency.
2026-11-20 09:48:14 -08:00
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