lightcraft/crates
Brandon Thomas 2218ca5a4c Issue #78: GPU export: respect device limits, fall back to CPU on GPU errors
A GPU render no longer hands back an image it cannot vouch for:
- set the wgpu device-lost callback (wgpu never reports a lost device as an
  error, so a driver reset went unnoticed); readback waits with a timeout and
  checks the poll result and map callback instead of blocking forever
- each render runs in OutOfMemory/Validation/Internal error scopes; errors
  fail that render (OOM and limit failures for that render only, device
  errors for the process) and it is redone on the CPU
- every buffer is checked against the device limit when created (no
  validation error, no process-wide disable); LIGHTCRAFT_GPU_LIMITS=webgpu|<MiB>
  creates the device with lower limits to reproduce small adapters
- the output buffer is cleared and the per-pixel kernel writes alpha 255:
  any unwritten pixel (work silently dropped, the issue's all-black export)
  fails the render; an all-black result is re-rendered on the CPU
- renders submit per stage and every 16 M invocations, the per-pixel stage
  runs in ~4 MP bands: no long submission for a slow iGPU's watchdog to reset
- ui.inspect perf.gpuReason / perf.gpuFallback, app.gpu reason/lastFallback,
  System Info and Settings say why the GPU is off (e.g. llvmpipe skipped) and
  why the last render fell back

Tests: crates/gpu/tests/fallback.rs (limit, mid-render limit, validation
error, dropped work, black photo), engine export falls back to the CPU image,
banded 3000x2000 GPU/CPU equivalence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 05:06:24 -04:00
..
catalog Merge main into fix/local-record-eviction 2026-10-05 02:59:05 -04:00
codecs Merge pull request #54 from storytold/pr/never-crash-codecs-catalog 2026-10-04 14:23:05 -04:00
color Never crash: color, geom, raster, develop, scenes, preview, pipeline 2026-10-04 12:34:53 -04:00
develop Never crash: color, geom, raster, develop, scenes, preview, pipeline 2026-10-04 12:34:53 -04:00
engine Issue #78: GPU export: respect device limits, fall back to CPU on GPU errors 2026-10-05 05:06:24 -04:00
geom Never crash: color, geom, raster, develop, scenes, preview, pipeline 2026-10-04 12:34:53 -04:00
gpu Issue #78: GPU export: respect device limits, fall back to CPU on GPU errors 2026-10-05 05:06:24 -04:00
mcp Issue #29: Import: Move mode with rename and template folders 2026-10-04 15:39:30 -04:00
merge Never crash: gpu and merge free of panicking calls 2026-10-04 12:34:53 -04:00
meta Merge main into feat/gpx-tracklog 2026-10-04 15:31:45 -04:00
pipeline Merge pull request #56 from storytold/pr/never-crash-core 2026-10-04 14:23:22 -04:00
preview Merge pull request #56 from storytold/pr/never-crash-core 2026-10-04 14:23:22 -04:00
raster Merge pull request #56 from storytold/pr/never-crash-core 2026-10-04 14:23:22 -04:00
raw Merge pull request #53 from storytold/pr/never-crash-raw-tiff 2026-10-04 14:22:47 -04:00
scenes Never crash: color, geom, raster, develop, scenes, preview, pipeline 2026-10-04 12:34:53 -04:00
sysmem Never crash: move the one unsafe FFI call into crates/sysmem 2026-10-05 02:06:08 -04:00
tiff Merge pull request #53 from storytold/pr/never-crash-raw-tiff 2026-10-04 14:22:47 -04:00
ui-egui Issue #78: GPU export: respect device limits, fall back to CPU on GPU errors 2026-10-05 05:06:24 -04:00