Main now occupies V13 through V16 (LATEST = V16), so this branch moves the
Apple ProRAW tone chain to V17 (LATEST, appended to Process::ALL). V1 to V16
and the 9->V8 / 11-12->V10 fallbacks are preserved unchanged.
Also addresses CodeRabbit's smart.rs review comment: deserialize SmartFacts::proraw
leniently so an invalid curve is ignored instead of dropping the rest of the stored
facts and mattes.
Co-authored-by: Exalted5373 <247056922+Exalted5373@users.noreply.github.com>
* Wait for a GPU warm-up still in the driver when quitting (#620)
LightcraftApp::shutdown gave GPU work at most the exit wait (2 s), the
device warm-up included, and the Drop wait from #4697 is skipped once
shutdown has run. A quit while a slow device start-up was still loading
the driver therefore ended the process with the warm-up inside the Vulkan
loader: exit() blocks on the loader lock or tears down libLLVM while the
warm-up thread is running its constructors, and crashes.
The warm-up can't be called off, so shutdown now waits for it past the
render deadline, bounded by the same 30 s the Drop wait uses (now one
constant, WARM_UP_EXIT_WAIT). Renders still give up after 2 s.
Regression: quitting_waits_for_a_warm_up_past_the_exit_wait holds a
substitute warm-up on the real gate and checks that shutdown(ZERO) does
not return until it is released (in a child process, since shutdown is
process-wide).
* Exercise the native quit timeout warning with a held render
* LR-BEHAV-GPU: no GPU warm-up is still loading the driver when a test or headless process ends (issue #620)
The first frame starts the GPU device warm-up on a thread of its own. A process
that ended a few milliseconds later, as every test does under nextest, could
exit while that thread was inside the Vulkan loader's dlopen of the driver,
running libLLVM's initializers: a SIGSEGV after the test had passed, or a hang.
Only the window's exit (LightcraftApp::shutdown) waited for GPU work.
warm_up now counts as in flight from the moment it is called, before its thread
exists, and wait_warm_up waits for it. Dropping a LightcraftApp waits for it,
bounded, unless shutdown already ran.
* LR-BEHAV-GPU: warm_up counts as in flight before it marks itself started (issue #620)
A second warm_up call racing the first could find it marked started and return
before the first had entered the gate, so a host dropping its app right after
that second call saw no warm-up in flight. The gate is now entered first, a
call that starts nothing drops its entry, and a closed gate starts nothing.
* LR-BEHAV-GPU: the app waits for the GPU warm-up when dropped on native builds only (issue #620)
The web build has no warm-up thread (warm_up and wait_warm_up do nothing there),
and the web host replaces the app's UI state by moving it out of the app, which
a Drop impl forbids (E0509 in the wasm check).
* LR-BEHAV-GPU: a deterministic test for the app's warm-up wait on drop (issue #620)
Fred's review of #4697: the first regression test could pass without
exercising the wait — ready() || !enabled() also holds when the warm-up
finished or never started, and no pending warm-up was ever established.
The gpu crate exposes doc-hidden test support, hold_warm_up_for_test(),
entering the same gate the real warm_up enters: a substitute warm-up the
caller holds. The test proves it is in flight (wait_warm_up(ZERO) is
false), builds an app that never ran a frame on another thread (the app
is not Send — its host-service callbacks are not — so it is built there),
and verifies with channel synchronization that dropping the app does not
return while the hold is kept, and returns once it is released. Without
the wait in Drop for LightcraftApp it fails at that assertion; with it,
it passes. No GPU, no device, no timing beyond a one-second observation
window whose proof is the release.
---------
Co-authored-by: skylartaylor <skylartaylor@users.noreply.github.com>
* Share one GPU device in the thumbnail tests
gpu_drawn_fixture created a new wgpu instance, adapter and device for every
test. Its vkEnumeratePhysicalDevices unloads drivers that expose no device,
while another test thread's render calls vkSetDebugUtilsObjectNameEXT on the
process-wide device; Vulkan loaders before 1.4.345 then walk freed loader
state and crash with SIGSEGV (KhronosGroup/Vulkan-Loader#1863). The fixture
now reuses the render device (gpu::shared_device), or one process-wide device
that is never dropped.
render::thumbnail_tests looped 200 times (2 test threads): 31/200 SIGSEGV
before, 0/200 after.
* Keep the thumbnail tests' fallback device from racing the render device
gpu::shared_device returned None while the render device could still be
created later (GPU rendering turned off by another test through app.gpu, the
window's device pending), and gpu_drawn_fixture then created a Vulkan instance
of its own while another thread's render could create and use the render
device: the Vulkan-Loader#1863 race again. shared_device now creates the render
device whatever the preference, and waits while the window's device is being
adopted, so None means no render device can exist in this process any more
(switched off by the environment, creation failed, or the process is ending).
The fixture creates its own device only when the environment switches the GPU
off or creating the device failed: once the process is ending it skips the
test rather than create a device during teardown. The wait for the window's
device has a 60 s deadline and then panics, since returning None would let the
fixture race the window's device.
shared_device overrides the switch that keeps the GPU off (also after a launch
that crashed creating the device, #136), so the app must not have it: it now
exists only in the gpu crate's tests and with a new test-support feature, off
by default, which only dev-dependencies turn on (ui-egui's, and the gpu crate's
own for tests/shared_device.rs). The app's and the workspace's normal builds
don't have it.
The fixture's texture work runs inside error scopes, so an error in it fails
the test instead of stopping GPU rendering for every test in the process.
tests/shared_device.rs: with GPU rendering off and the window's device pending,
shared_device waits for the adoption and settles the render device.
render::thumbnail_tests looped 100 times (2 test threads): 100/100 passed;
with LIGHTCRAFT_GPU=0 (the fixture's own device) 50/50 passed.
Under process V14 the GPU renderer read the whole image back, ran the
spots on the CPU and uploaded the whole image again: about 120 ms of
transfer on a 24 MP export, even for one spot. Each spot now reads back
only the rectangle it reads (its box and its source patch,
`spots::spot_reads`), is healed on the CPU by the same code as the CPU
renderer (`spots::apply_spot`, split out of `spots::apply`), and only
its box is written back. The V13 path is unchanged.
Main gave V10 to the checked Bradford white balance (#4599) and 13 and 14 to the
Shadows calibration and the pinned heal; #4047 (Flow per radius travelled) is V15.
So this PR's stroke feather moves from V10 to the next free number, V16 = V15 plus
feather, as asked in the review comment on #4517.
- includes #4047's head (898de527) so the stack lands in order: V15 Flow, then V16 feather
- Process::V16 is LATEST and appended to Process::ALL; masks::stroke_feather,
the GPU brush_aux word and brush_live switch on V16, not V10
- V1 to V15 render as before (a_saved_process_keeps_its_brush_look)
- docs/process-versions.md, parity checklist and whats-new (Unreleased) updated
Co-authored-by: Dimitrij Denissenko <dimitrij.denissenko@blacksquaremedia.com>
finish_and_read took a fresh MAP_READ staging buffer for every readback
(~96 MB for a 24 MP export) and waited for everything on the queue.
Staging buffers now share the free pool with storage buffers, matched on
usage so neither is handed out as the other, and are returned after a
clean copy-out (dropped after any failure). Gpu::submit returns the
SubmissionIndex and the readback waits only on it; the 60 s timeout,
the 10 s callback grace period and the lost-device handling are kept.
* LR-EDIT-CURVE: show sampled Tone Curve input (#987)
Keep the output Histogram separate. Sample each selected curve's input
with the production prefix LUT builder and strict request identity.
Preserve current main's source facts, mask behavior and render output.
Credit @zelefogs for the request and @aiongg for the input/output
clarification. Human contributor credit remains @AlexChambers.
Co-Authored-By: GPT-6-Astra <noreply@openai.com>
* LR-EDIT-CURVE: refresh curve input source after relink (#987)
Rebuild the prepared diagnostic job when its origin changes, even if
the content hash and render key stay the same. Retain completed
histograms for identical content.
Add a real-file regression through import, relink, the prepared-job
caller flow and the native worker. Check the actual retry path,
source facts and successful recovery.
Co-Authored-By: GPT-6-Astra <noreply@openai.com>
* LR-EDIT-CURVE: bound histogram UI test work (#987)
Use two small generated PNGs for the input-histogram tests. Keep the
production decoder, render queue and pipeline, and retain the 20-second
settle budget. The full demo library adds unrelated thumbnail and
neighbor work when the failure gate opens.
Assert that stale cached histograms stay hidden during pending and
failed replacements, and verify that clearing the selection leaves
no active photo. Keep the existing histogram stage checks.
Human contributor credit remains @AlexChambers.
Co-Authored-By: GPT-6-Astra <noreply@openai.com>
* LR-EDIT-CURVE: adapt the histogram to main's render parameters (#987)
Carry the curve input source, edit panel and tests into the module layout and
render-parameter API on current main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* LR-EDIT-CURVE: register the histogram label with the panel's Ui (#987)
Main's register now takes the Ui, not its Context.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* LR-EDIT-CURVE: match unknown channels to the Point input (#987)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* LR-EDIT-CURVE: refresh the parity summary after the merge
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* LR-EDIT-CURVE: fit the merge to main's three-argument file loader; histogram-only slots in one helper (#987)
Main's loaders take the camera profile as a third argument, so the curve tests' loaders take it too. Keeping the Tone Curve and HDR histograms moves into keep_histogram, which brings Renderer::collect back under the cognitive complexity limit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* LR-EDIT-CURVE: the input diagnostic's pixels are dithered like the render's (#987)
Main's finish dithers its 8-bit output with an 8x8 Bayer pattern (#3509). The diagnostic's image used plain rounding, so it no longer matched a render with the later curves removed; it now encodes with finish's dither at the same output position. Its histogram still bins the undithered samples.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* LR-EDIT-CURVE: refresh the parity summary after the merge
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* LR-EDIT-CURVE: refresh the parity summary after the merge
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* LR-EDIT-CURVE: refresh the parity summary after the merge
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Trim duplicate Tone Curve histogram tests (#987)
* LR-EDIT-CURVE: check the brush budget before sampling a curve's input (#987)
The Tone Curve input diagnostic went straight into mask preparation in
both the native render job and the web worker, skipping
check_brush_budget. An over-budget brush then lost its later strokes and
the backdrop showed that partial sample as the curve's input.
curve_input::render now runs check_brush_budget on its own clamped,
full-crop request (at most 256 px, no window) and returns a Result, so
both callers fail the request and the UI shows "Input histogram
unavailable". Regression tests cover the pipeline, the native job, the
worker and the headless UI.
* LR-EDIT-CURVE: tell screen readers the selected channel and the input status (#987)
The Tone Curve's channel buttons now report which channel is selected
(toggled), through the same helper the segmented controls use. The input
histogram's caption is a polite live region, so screen readers read it
when it changes between loading, sampled and unavailable, and the focus
stays where it is. A new announce_live helper sets the live region; the
AccessKit adapters read a live node only when its text changes.
The headless test view keeps the last frame's AccessKit tree in test
builds, and a new test checks both behaviours through it.
---------
Co-authored-by: GPT-6-Astra <noreply@openai.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
The horizontal box pass summed its whole 2r + 1 window per pixel, so wide
blurs (Dehaze: sigma = 2 % of the long edge) cost O(r) per pixel. On an
Intel iGPU one pass took 1.8 s at radius 120 and 8.8 s at radius 500 on a
6000 x 4000 plane, long enough for a driver reset.
From radius 8, `gaussian` now transposes the image (new `transpose`
kernel, a 16 x 16 tile per channel plane in workgroup memory), runs the
horizontal passes as `box_v` on it (running sum, coalesced reads) and
transposes back. `box_v` primes over the window clamped to the image and
its run is no longer capped at 128 rows, so its work per pixel is bounded
at any radius too.
`bench_kernels` covers more radii, the transpose and whole blurs, skips
lone `box_h` passes wider than 120 and reports a failed render instead of
timing nothing after it.
Full re-review after the branch rewrite (Add operator in the ONNX reader, net validation, CPU and reference runners; GPU planner refuses it as unsupported). Clean merge.
Conflicts:
crates/engine/src/media/source.rs
Conflict in crates/engine/src/media/source.rs: main moved RENDER_CACHE_VERSION to 84 (83 reserved by open #3943); this PR's bump is now 85 with a note line in main's style.
Main shipped V13 (#3923) and V14 (#4069) after leaving 12 for this pull
request. A V12 Flow would now also change saved V13 and V14 photos, so it
becomes V15 = V14 plus Flow per brush radius travelled, the latest; V1 to
V14 keep the flow per dab. 11 and 12 name no process (render as V10).
Main's latest is V13 (#523). The heal moves to V14 = V13 plus the pinned heal, so saved V13 spots keep the averaged heal; 9, 11 and 12 name no process (12 stays claimed by #4047).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main took V8 (lettering-safe Highlights/Shadows base, #3460) and V10 (checked Bradford
fallback, craft-libs#587), and reserves 9 for #4069; 11 and 12 are claimed by the open
#4069 and #4047. So this PR's Shadows easing, negative Texture and Global wheel are
process V13 = V10 plus these changes, and V1 to V10 render as on main.
- finish::tone_slider / texture_slider and colorops::global_wheel gate on V13.
- The colour ops moved to craft_develop on main: the Global wheel's share is applied
to the resolved wheel in lightcraft's ColorOps::new, so craft-libs is untouched.
- Tests check every process before V13 keeps the linear amounts and the Global
wheel, and relations instead of the fitted values (AGENTS.md rule 28); process
numbers 11 and 12 fall back to V10.
- Tests that meant V10 build V10 settings instead of relying on the default.
- docs: process-versions, parity checklist, gaps and what's new say V13.
Main now has V10 (checked Bradford white balance) and reserves 9 for #4069;
11 and 13 are claimed by open pull requests. Flow per brush radius
travelled moves to V12, marked provisional; earlier processes keep the flow
per dab and the Flow tests compare against V10. Main's two V10 white-balance
tests now set V10 explicitly instead of taking the default, which moves on.
Preserve the existing V10 default, checked white balance, and stored numeric 9 fallback. Keep the ProRAW route explicit under a provisional process ID pending rollout review.
main writes process V10 (#4599) and renders a saved 9 as V8. The pinned
heal becomes V11, after the latest writable process: HealMethod::of picks
it from V11, so saved V8, 9 and V10 spots render as they did on main. The
number 9 stays unused (main's docs no longer call it reserved for this PR).
saved_spots_before_v11_render_as_they_did pins Heal, Remove and Clone
pixels that main rendered for saved 8, 9 and 10, and checks V11 differs;
spots_match (GPU) runs on V10 and V11. main's two V10 white-balance tests
now ask for V10 instead of the default, which is V11.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* develop,pipeline,color: add Process::V9 checked warm-green WB fallback (#587)
* fix(color): use root-reexported craft_color_transform::RgbSpace
* develop,pipeline,docs: use Process::V10 for checked WB and reserve V9 for #4069
* pipeline: include checked_wb in pre_nr_key for StageCache invalidation
* pipeline: wrap scene in Arc for render_cached in WB cache test
- A dab with no Flow (at pen pressure 0) no longer sets the stroke's
edge: it could make a light pen stroke stronger.
- The edge plane covers only the stroke's bounds and is combined in place,
instead of a full-frame plane per stroke (about 92 MiB on 24 MP).
- Auto Mask strokes keep V9's accumulation: their edge follows the
photo's, not the feather, and V10's build-up made their colour
weighting count for far dabs too (a rejected dab added Flow, and a
window render drifted from the whole frame by up to 10 LSB).
- whats-new and the LR-MASK-BRUSH row say the 90 % to 50 % example is at
Flow 100, and that Auto Mask strokes are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A stroke accumulated every dab's falloff times its flow, and its dabs
lie r/4 apart, so their soft edges piled up into a nearly hard one: at
Feather 100 and Flow 100, halfway out from a straight stroke's centre
line was 0.90 covered, where one dab covers 0.50.
Process V10 keeps a stroke's Flow build-up (each dab that reaches a pixel
adds its flow, masks::feather_dab) apart from its edge (the highest
falloff of those dabs) and covers their product up to Density
(masks::stroke_coverage). At Flow 100 a stroke's edge then falls off over
the feather exactly as one dab's; below it the centre builds up by Flow
per radius travelled (V9) whatever the feather.
CPU, GPU (a 13th stroke-record word in the shape kernel) and the live
stroke share the helpers. V1 to V9 render as before; Feather 0 brushes
render as on V9. Stacked on #4047 (V9).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>