Skip to content

fix(raster): affine sampler round-1 tests, per-axis kernel cap, clearer docs - #598

Merged
github-actions[bot] merged 1 commit into
devfrom
lead/affine-composite-r1-b1
Oct 19, 2026
Merged

github-actions[bot] merged 1 commit into
devfrom
lead/affine-composite-r1-b1

Conversation

@prakashUXtech

@prakashUXtech prakashUXtech commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Anatomy round 1, batch r1-b1 for affine-composite: the review findings on transformed, padded and the packet. Part of #434.

Fixes

  1. Overshoot error says what to do. The non-finite output error now reads "transform by with : lanczos3 overshoot made a component non-finite; use .bilinear or keep components finite". Proven by AffineOpsTests.overshootThrows, which checks that the message contains "lanczos3".
  2. padded doc states its placement rule. It grows with transparent pixels and shrinks by cropping, and the top-left moves by the size change times the anchor's place (0, 0.5 or 1), rounded down. CanvasSizeTests.centreRoundsDown already pins this; the change is docs only.
  3. Packet pseudocode matches the API as built. resampled is now resized(width:height:filter:). The scale-only separable fast path is dropped, with the reason: resized reads clamp-to-edge and transformed reads transparent outside. The packet also says the kernel widens for any scale below 1. Docs only.
  4. Downscale widening is tested. New AffineOpsTests.downscaleWidensKernel: a 0.25 shrink of one-pixel stripes (columns, then rows), placed so each output centre lands on a source centre, is flat 0.5 grey within 1e-3 for bilinear and lanczos3. Stripes rather than a checkerboard, because a checkerboard averages to grey through either axis alone, so forcing stretchX to 1 escaped. New mutation entry: let stretchX = 1.0.
  5. Filtered values are normalised means and fade at the edge. New AffineOpsTests.halfPixelTranslationBlends: a bilinear 0.5 px shift of a seeded opaque layer gives alpha 0.5 and half the colour in column 0, and two-neighbour means inside (within 1e-5). Lanczos3 on a uniform opaque layer stays alpha 1 inside. New mutation entry: dropping / total.
  6. Huge whole translation is exercised. New AffineOpsTests.hugeWholeTranslationIsClear: translations of (1e300, -1e300) and (Int.max x 4, 0) return a clear 10 x 8 buffer. New mutation entry deletes the abs(m.tx) <= limit, abs(m.ty) <= limit clause; with it removed, Int(m.tx) traps and the runner counts the crash as caught.
  7. Overshoot throw is exercised. New AffineOpsTests.overshootThrows. Columns follow a period-4 +max, +max, -max, -max pattern of Float.greatestFiniteMagnitude, which matches lanczos3's lobes; plain alternation cancels at Nyquist and cannot overflow. Through a 0.3 px shift they overshoot by about 1.37x and throw RasterError.invalid. New mutation entry removes the finite guard.
  8. Kernel stretch is capped per axis. stretchX is capped at width and stretchY at height; before, both were capped at max(width, height). New AffineOpsTests.extremeShrinkOnNarrowAxisIsBounded: a seeded 2 x 20000 layer through a = 1e-7 and through a = 1e-3 (lanczos3, 4 x 20000 output) gives equal results in about 0.15 s. Optional mutation entry added (swap back to max(width, height)); the runner catches it in about 40 s.

Checks

  • scripts/mutate --run --changed-since origin/dev: 11/11 caught. That is 9/9 in CoreRaster.AffineTransform (4 existing, 5 new) and 2/2 in CoreRaster.CanvasSize.
  • scripts/ci prints CI: PASS on this head, after rebasing on origin/dev. Before the rebase, two runs failed on an unrelated wall-clock budget, CoreAssetTests.ThumbnailStoreRecoveryTests/fuzzedIndexThrowsOrRecovers (1.5 to 2.4 s against a 1 s budget). The machine's load average was 8 to 13 on 4 cores. The test takes 0.3 s when run alone, and this diff does not touch CoreAsset.
  • APIs: Swift stdlib only (Float.greatestFiniteMagnitude, Double.squareRoot(), isMultiple(of:)). No platform or library API is new; I did not check the docs MCP for these.
  • I did not touch the AC-5 files (CompositeAffine.swift, AffineStubTests.swift).
  • Branch is lead/affine-composite-r1-b1: the existing lead/affine-composite ref blocks a lead/affine-composite/r1-b1 ref.

Part of #434

Belt-Lead: act-1a150bfbcf7-sfwy
Feature: affine-composite
Slice: AC-geo
Mutate: 9/9 CoreRaster.AffineTransform
Fast-Check: pass
Head: 3a1bc68

@prakashUXtech prakashUXtech added the fast-lane Small green PR, auto-merge when eligible label Oct 19, 2026 — with Claude
@github-actions
github-actions Bot merged commit 1a8dc5d into dev Oct 19, 2026
1 check passed
@github-actions github-actions Bot added the fast-lane-merged Merged by the fast lane; review after the fact label Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Fast lane: merged into dev (176 lines, 5 files, Fast-Check marker).

prakashUXtech added a commit that referenced this pull request Oct 19, 2026
@github-actions github-actions Bot mentioned this pull request Oct 19, 2026
prakashUXtech added a commit to qbtrix/creative-apps that referenced this pull request Oct 19, 2026
…rallel (#3126)

Moves the creative-core pin from bf5426e to 0de5687, the head of core
`main` (green, promoted from dev). The range has the resident-rendering
speedups from qbtrix/creative-core#620: the batched composite commits
without waiting, the resident dirty check is storage identity instead of
a pixel compare, and the Float16 tile upload vectorizes. It also has
qbtrix/creative-core#626, which repoints the mutation anchor #620 moved.

Core range (58 commits):
qbtrix/creative-core@bf5426e...0de5687

Core PRs in the range: qbtrix/creative-core#567 qbtrix/creative-core#568
qbtrix/creative-core#569 qbtrix/creative-core#570
qbtrix/creative-core#571 qbtrix/creative-core#573
qbtrix/creative-core#574 qbtrix/creative-core#575
qbtrix/creative-core#576 qbtrix/creative-core#577
qbtrix/creative-core#578 qbtrix/creative-core#579
qbtrix/creative-core#580 qbtrix/creative-core#581
qbtrix/creative-core#582 qbtrix/creative-core#583
qbtrix/creative-core#584 qbtrix/creative-core#585
qbtrix/creative-core#586 qbtrix/creative-core#587
qbtrix/creative-core#588 qbtrix/creative-core#589
qbtrix/creative-core#590 qbtrix/creative-core#591
qbtrix/creative-core#592 qbtrix/creative-core#593
qbtrix/creative-core#594 qbtrix/creative-core#595
qbtrix/creative-core#596 qbtrix/creative-core#597
qbtrix/creative-core#598 qbtrix/creative-core#599
qbtrix/creative-core#600 qbtrix/creative-core#601
qbtrix/creative-core#602 qbtrix/creative-core#603
qbtrix/creative-core#605 qbtrix/creative-core#606
qbtrix/creative-core#607 qbtrix/creative-core#608
qbtrix/creative-core#609 qbtrix/creative-core#612
qbtrix/creative-core#613 qbtrix/creative-core#614
qbtrix/creative-core#615 qbtrix/creative-core#616
qbtrix/creative-core#617 qbtrix/creative-core#618
qbtrix/creative-core#619 qbtrix/creative-core#620
qbtrix/creative-core#621 qbtrix/creative-core#622
qbtrix/creative-core#623 qbtrix/creative-core#625
qbtrix/creative-core#626

Besides the pin:
- `project.yml` gets the same revision, as in #3023.
- `PhotoWorkspace.residentComposited` syncs a region's layer tiles
across the cores (through `PhotoLayerComposite.inParallel`), as the CPU
route renders its tiles. Steps keep their order. On a brush frame that
crosses two tiles the sync went from about 0.73 ms to 0.39 ms.
- `Tests/render-budgets.md` has the new 8K table and says where a
resident brush frame's time goes.

8K brush frame, release on the M2 Pro (median of three runs; the Mac was
loaded, with another Photo running): CPU 1.0 ms, GPU-resident 1.4 ms
(was 1.7). The GPU route is still behind the CPU. Most of what's left is
the display into the presenter's texture, which waits about 0.55 ms for
the GPU because the presenter draws from its own queue. Full redraw on
the resident route is 31 ms (was 35) and the first picture 166 ms (was
192).

Checked locally on macOS: `scripts/bump-core`'s steps at 0de5687. `swift
build --build-tests` passed. Every `*ModelTests` target passed except
four Library wall-clock budget tests
(`oneEditOnSixtyPhotosStaysInBudget`, `cullOneWithinBudget`,
`beginImportWithinBudget`, `orderRebuildWithinBudget`), which went over
in the parallel run on the loaded Mac and pass when run alone. The brush
perf suites (PhotoBrushDisplayTests, PhotoBrushLatencyTests,
PhotoBrushInkLatencyTests) passed. With the parallel sync on top,
`PhotoModelTests` and `PhotoRenderBackendTests` passed (647 tests), and
`PhotoRenderBudgetTests` ran in release with
`Tests/SuiteUITests/SegmentedTabsTests.swift` set aside, since it
doesn't link in release on SDK 27.
prakashUXtech added a commit that referenced this pull request Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fast-lane Small green PR, auto-merge when eligible fast-lane-merged Merged by the fast lane; review after the fact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant