Keeps both test modules in crates/format/tests/it/main.rs: main's camera_raw_roundtrip and this PR's channel_mixer_cmyk.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the conflict in crates/engine/src/adjust_params.rs: keep this
branch's generic mixer_row (RGB rows of 4, ink rows of 5) and main's
rounding to whole percentages before clamping (#14414).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
main moved the command table out of crates/engine/src/cmd.rs into crates/engine/src/cmd/table/. cmd.rs takes main's version; this PR's Channel Mixer params doc (cyan/magenta/yellow/black ink outputs, monochrome unsupported for CMYK outputs) now lives on the channelMixer entry in cmd/table/image/adjustments.rs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Document.layers is a LayerTree that builds an id index on first lookup and drops it on any mutable access. Layer lookups and selected_layers use the index instead of walking the document.
The shader's Gradient Map LUT returns the stop colour unchanged, so the
GPU compositor kept a coloured gradient in a Grayscale document while
the CPU path now keeps the stop colour's CIE L* (#14698). The planner
returns Unsupported for that case, as it does for CMYK/Lab channels, so
the whole document falls back to the CPU compositor.
Every compositor built all ~30 pipelines when created. On the Windows CI
runners (WARP, FXC) that took 3 to 7.5 s in every GPU test process, and a
test that draws one layer needs two or three of them.
The pipelines now sit in one table per compositor (shared with its
siblings), one entry per kernel, each built the first time a draw needs
it. try_new_with_format_threads(_classified), which the app uses for its
background build, still builds every pipeline up front in parallel
through the same table, so the app keeps its start-up error and its
cached deterministic-failure path. A pipeline that fails on first use
makes that render Unsupported (CPU fallback); a failed effect-map
pipeline turns layer effects to the CPU as before.
The #9173 rules hold: each kernel has its own vertex entry point, a
kernel's formats are built on one thread, and every build in the process
takes the same lock.
every_compositor_pipeline_builds builds all pipelines through the
threaded build, so FXC still compiles every shader on Windows CI. New
count test: one layer builds a small share of the pipelines, and a second
render or a sibling builds none.
main (#15449) moved the adjustment editors onto the craft UI framework and deleted basic.rs, which held this PR's CMYK Channel Mixer editor. The framework ChannelMixer has red, green and blue rows only, so a CMYK mixer is now kept out of it: values::from_params refuses a mixer with ink keys (CMYK_MIXER_UNAVAILABLE), the Properties panel shows that message and edits nothing, and Image > Adjustments > Channel Mixer refuses to open in a CMYK document with the same reason. A CMYK editor in craft-libs is the follow-up.
ui_tests.rs keeps main's tests; the test of the deleted egui editor is replaced by cmyk_channel_mixer_is_kept_out_of_the_rgb_editor, and the every-kind Properties test expects the refusal for a CMYK mixer. The Tokens::mixer_rgb/mixer_ink fields added for the deleted editor are dropped (no user left).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
PhotoCraft's UI moves onto the shared craft UI framework in storytold/craft-libs (next branch): shell, dock and panels, hosted dialogs, keyboard, focus, IME and pointer routing, the canvas's view commands, themes and tokens. The engine, document model, file formats, commands and automation stay. PhotoCraft pins storytold/craft-libs next.
A split Blend If slider faded as (v - low) / (high - low), so the fade
started a level late and every value between the halves showed a little
less of the layer than the reference application. 8-bit documents now
fade as (v - low + 1) / (high - low + 1) on the black side and
(high - v + 1) / (high - low + 1) on the white side, on the CPU
(BlendRange::weight_8bit through blend_if_weight) and the GPU (bi_ramp,
flagged per pass in p4.z). Unsplit points and 16/32-bit documents keep
their behaviour.
The geometry gate reads the Size and the Choke, not the measured
Distance 0, so an Anti-aliased Inner Shadow at Distance 5 runs on the
sub-pixel source path with no pin on either compositor. Add it: the
source shift stage carries the whole-pixel light offset plus the third
of a pixel, exactly as `shadow_map` shifts by `dx + aa`; the Choke 50 %
program at that Distance stays the flag-off program, distance-field
stage included; and the GPU-vs-CPU parity check now covers both rows on
the whole-texture and the paged compositor. The Distance rows sit inside
the two tests that were red before the gate; on their own they pin that
the gate leaves a shifted light offset alone, so they would be green
either way.
An independent review found that the third-of-a-pixel source offset sat on
every Size, Choke and Distance with Anti-aliased on, while only Size 10 at
Choke 0 was measured. Both neighbours of that configuration are
degeneracies of `spread_split`: at a blur width of 1 (Size 1, or Size 2 at
Choke 50 %) `dilate` no-ops and the tent blur is the identity, so the
offset became the whole map - 1/3 coverage on the bottom and right inner
edges (G 89.7 against the layer's own 128) and nothing at the top and
left, a one-sided black line. At a Choke that dilates the CPU recomputes
its chamfer distance on the offset map while `B::spread_blur` shifts the
whole-pixel `ChokeInside` field of the unshifted shape, so the two
compositors part by 40/255.
`aa_shift` now takes the Size and Choke and applies the offset only to a
split of no dilation and a blur wider than the identity, with the Gaussian
contour: a rule in the inputs, not the measured document's Size 10. Sizes
1.5 to 250 at Choke 0, Distance 5 and Choke 4 % (which dilates nothing)
still take it; Size 1, Size 2 at Choke 50 % and every Choke that dilates
keep today's map bit-for-bit. Four new CPU probes, one GPU stage-list
probe and one GPU-vs-CPU parity probe pin both sides: three of the CPU
probes and both GPU probes failed on this branch's head before the gate
(the parity probe at max diff 40.04/255, Size 10 Choke 50 %).
satin_map inverted the coverage before the contour LUT, so a curved
contour with Invert on was not the opposite of the same Satin without
Invert. Invert now applies after the contour on the CPU, and the GPU
satin stage uses fs_mfinish's existing after-contour mode.
Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
gpu/fx: the review asks for the Done-when line "CPU and GPU compositors
agree". `B::shadow` built the Inner Shadow map from the shape shifted by
whole pixels only, so the Anti-aliased checkbox stayed invisible on the
GPU: the parity check of the issue's document measured 20.65/255
between the two compositors once the CPU honoured the flag.
The map builder now calls the same gate the CPU does (`effects::aa_shift`,
inner branch and the Gaussian contour only), and `fs_mshift` samples the
way `Map::shifted` does: four taps, bilinear, with the invert and the
`outside` fill applied per tap. A whole-pixel offset weights its taps 1
and 0, so every shift that exists today (drop shadows with Distance,
satin, the Choke/Spread field shift) reads exactly the texel it read
before. The stage radius ceils, so a sub-pixel shift's extra tap stays
inside the window the executor recomputes - what makes the paged
compositor agree.
Two tests: the stage list, which needs no device, and the issue's
document rendered on both compositors (plain and paged 256 px),
comparing the four edge ramps against the CPU and against the issue's
measured values.
A Size 1 inner shadow with Choke 0 blurred the inverted shape with a
width-1 box, which is the identity: the map kept the hard inverted
alpha and the clip to the layer at the end of shadow_map removed the
shadow completely, so every edge pixel stayed at the layer's own colour.
Apply the quarter taps at that one width instead - the width-1 box split
into its two half taps at plus and minus half a pixel, taken twice, as
tent takes a box: 1/4, 1/2, 1/4 at radius 1. That puts 0.25 coverage on
the first pixel inside every edge, which flattens to the measured G 96
with G 128 one pixel deeper. The Inner Shadow program on the GPU takes
the same published kernel through its existing separable conv, so both
compositors agree.
The kernel is new code next to the blur, not a change to box_width,
box_weights, tent_kernel or blur: sizes 0, 0.5, 1.5 and 2 to 250, the
Drop Shadow of the same size (#14880) and a choked Size 1 keep their
pre-change maps bit for bit, pinned in the new test file.
Fixes#14933
* Escape control characters in log lines and diagnostic output taken from files and plug-ins
* address review: escape the plug-in load error and the atn_dump path before printing
craft-cms was extracted from crates/cms (storytold/craft-libs#779), and both
copies changed afterwards. storytold/craft-libs#PRNUM ports the 41 commits made
here since the extraction, so the shared crate now has everything this copy
had, and PhotoCraft depends on it.
craft-cms returns errors where the local crate panicked on caller input:
transforms, tables and LUT constructors return Result. Call sites propagate
the error where the function already returns one, and fall back where the
arguments are fixed by construction (each with a comment saying why).
Lut3d's fields are private there; the proof and HDR display table is built
with Lut3d::from_fn.
The pin is the head of the craft-libs branch and moves to main when that
pull request merges.