Commit Graph
52 Commits
Author SHA1 Message Date
Tanish Manku 5c4b8594b3 chore: merge main into m3/stroke-coverage 2026-11-18 00:34:53 -07:00
Tanish Manku 28fcfd23c6 fix(render): a stroke's coverage is that of one outline, not of overlapping pieces (M3)
The stroker builds each run of segments as its own outline (inner edges cut where they
cross, through the bend's point where they can't) and unites the loops, so the
renderers' sum of signed areas is the stroke's true coverage: no pixel is darker where
pieces overlapped (it was up to about half a pixel at round joins, caps and the joints
of wide curves). The GPU stage draws the oracle's polygons, so it follows.

Fourteen corpus goldens change, all at stroke edges (lighter; the dark knots at
corners go). Measured, median of 80 renders, before -> after: 2,000 stroked shapes at
1080p 9.3 -> 9.0 ms; the demo 2.5 -> 2.6 ms; 300 self-crossing scribbles at 720p
5.9 -> 6.4 ms; edges handed to the rasterizers down 3 to 4 times.
2026-11-17 23:33:55 -07:00
Tanish Manku c23fa96ccd feat(render): layer opacity in the HTML canvas export, with CPU pixel and GPU parity tests (M1) 2026-11-17 23:32:53 -07:00
Tanish Manku 20ac637cc6 feat(doc): an instance's transformation point in tweens, and layer opacity as a fade group (M1) 2026-11-17 23:32:53 -07:00
Tanish Manku 0566b715b9 chore: merge main into the editing issue batch (M1)
# Conflicts:
#	CHANGELOG.md
#	docs/guide/drawing.md
#	docs/roadmap.md
2026-11-17 21:50:44 -07:00
Tanish Manku 448c7aefbb test(gpu): the gate test's control run waits until its detector has seen the race (M1)
The run without the gate only proves the detector works, but it had 300 ms to
see an overlap, and on CI's Linux runner (busy with the software GPU tests) its
threads sometimes had not run by then: it failed twice in a row on this branch.
It now goes on until it has seen one, for at most 30 s.
2026-11-17 21:11:44 -07:00
Tanish Manku 8b213bc76b test(gpu): the submit gate's control run gets a few tries on busy runners (M8)
Without the gate the detector must see the race, but on a two-core runner the workers and the
detector may not overlap in one 300 ms run (it failed once on the Linux gate). The gated run
still has to hold in every run.
2026-11-17 20:46:51 -07:00
Tanish Manku b805c38ac8 test(gpu): the gate test's control run can't miss the race on a busy machine (M8) 2026-11-17 18:13:20 -07:00
Tanish Manku 95273a0909 test(gpu): the gate's tests wait on what happened, not on the clock (M8)
On the macOS and Windows runners a helper thread had not started its
submission when the test closed the gate 20 ms later. The tests now wait for
the state they are about (a channel, the gate's own counts) and keep only the
lower time bounds, which hold on any machine.
2026-11-17 17:43:16 -07:00
Tanish Manku c81de6d649 fix(gpu): submit stage work on the window's device only inside a frame (M8)
The stage renderer shares the window's device and submitted its work from the
render service's threads at any time. A window reconfigures its surface when
it opens and when it is resized, and wgpu fails that when another thread
submits meanwhile: 'Surface::configure: Failed to wait for GPU to come idle
before reconfiguring the Surface'. In 0.2.1 that error was a panic, so
AniCraft closed at start-up or on a resize (#264, #309, and with them the
'won't open' reports #421 #412 #313 #286 #285 #268 #164); since ADR 0092 it
is survived, at the cost of a skipped frame, an autosave and a status line
blaming the graphics driver.

A SubmitGate (crates/gpu) is open while the window's thread runs the app's
frame and closed otherwise, also around windows drawn inside the frame (Test
Movie, floating panels). Work waits for it (asking for a frame), at most
250 ms; the renderer's starting self-test goes through it too.

Measured on Windows 10, RTX 5090, Vulkan, --screenshot starts: the error in
3 of 20 starts before, 0 of 20 after; 2.81 s and 2.80 s per run.
2026-11-17 16:48:36 -07:00
Tanish Manku c2472cd639 chore: merge main (styled text, mixed armatures) into filter tracks (M5)
Text keeps its filters next to its styled runs. In HTML export, static text in several colours
with filters is one item of pieces (pp), so the pieces share one filtered group as evaluate
draws them; the page's player draws such items piece by piece.
2026-11-17 14:55:39 -07:00
Tanish Manku 2f6e9cc46b feat(export): filters on text in the HTML page and from XFL, with GPU parity (M5)
* The page's player draws text with filters in a filtered group of its own,
  as evaluate does (fx/fm on static text and fields); typed text in an input
  field is the browser's and is reported.
* XFL: a text field's <filters> come in on the text instead of being
  reported as skipped.
* GPU parity on filtered text: max 1/255, mean 0.003-0.005 (RTX 5090, Vulkan).
2026-11-16 19:17:17 -07:00
Tanish Manku 5da16a0fab feat(doc): styled runs, paragraph styles and colour fills on text blocks (M5) 2026-11-16 18:26:38 -07:00
Tanish Manku 5028a060e0 feat(app): survive GPU failures mid-session: CPU stage fallback with retry, window device watch, safer start after a loss (M3) 2026-11-13 20:43:11 -07:00
Tanish Manku f7d90f361c feat(engine): filters switch on and off, reorder, copy and paste, and filter presets (M5)
A filter list entry carries an enabled switch (FilterEntry, flattened into the filter's
own object, so older files open unchanged); evaluate and the HTML export leave switched-off
filters out, so every renderer and export draws them as absent. New filter.* commands:
move, enable, remove, copy, paste, and presets (list, save, apply, rename, delete, export,
import) kept in the session like brushes. XFL import keeps disabled filters, switched off.
Classic tweens pair lists that include switched-off filters.
2026-11-13 19:28:15 -07:00
Tanish Manku c9fdd00fb3 chore: merge main (drawing leftovers, Asset Warp) into camera depth (M7) 2026-11-13 00:26:19 -07:00
Tanish Manku 617c8c6963 feat(camera): layer depth over time in perspective, attaching layers, camera colour effects and editing through the camera (M7) 2026-11-12 20:50:47 -07:00
Tanish Manku 7a89c79d4b feat(render): warped bitmaps drawn through their mesh in the oracle, GPU parity (M7) 2026-11-12 19:52:31 -07:00
Tanish Manku a9e48b1184 feat(doc): warp meshes on shapes and bitmaps, bent by pins (rigid MLS), pins tween (M7) 2026-11-12 19:52:31 -07:00
Tanish Manku 00b2cba610 feat(render): gradient spread, focal point, ellipses and linear RGB (M1)
Paint::Linear and Paint::Radial gain optional spread (extend/reflect/repeat)
and linear_rgb; radial gradients gain a focal point and a matrix (any
ellipse). All default and are skipped when unset, so older files and plain
gradients are stored as before. The CPU oracle, the GPU stage (and its
emulator), SVG and HTML export, and SVG and XFL import handle them exactly;
Lottie reports what it can't show. Fill frames (Paint::frame/with_frame/
fitted) are the basis of the Gradient Transform tool.
2026-11-12 14:21:34 -07:00
Tanish Manku 960203fcde feat(gpu): soft masks on the GPU stage, at parity with the oracle (M4) 2026-11-12 00:53:52 -07:00
Tanish Manku 8cc0384bc1 feat(render): soft masks: mask layers reveal by their artwork's opacity or luminance (M4) 2026-11-12 00:53:52 -07:00
Tanish Manku b6cfa585c6 chore: merge main (colour effects, ADR 0056) into button sounds; hit-area tint on ColorTransform (M5) 2026-11-11 14:31:13 -07:00
Tanish Manku 54c27ef0d4 fix(symbol): 9-slice guides switched off are kept and come back when switched on (M5) 2026-11-11 14:00:10 -07:00
Tanish Manku cadfe62913 chore: merge main (9-slice, ActionScript logic, v0.2.0) into colour effects (M2) 2026-11-11 13:55:28 -07:00
Tanish Manku e24a23cd95 chore: merge main (ActionScript logic, v0.2.0) into 9-slice scaling (M2) 2026-11-11 13:43:27 -07:00
FredApps 1897f901d2 fix(gpu): wrap repeating bitmaps without a signed remainder, undefined on GL (M3)
The fine shader wrapped a repeating bitmap's taps with ((q % size) + size) % size.
naga (30.0.1) writes WGSL's integer % as GLSL's, which is undefined for
negative operands, and the bilinear tap left of or above the edge is -1. On
the GL backend (llvmpipe in the FreeBSD VM, which has no Vulkan driver) the
edge texels came out wrong: bitmap repeated max 79, filtered bitmap max 16, so
FreeBSD x86_64 has failed since bitmap fills landed (0dae205). Vulkan, DX12
and Metal define the remainder, so Linux CI passed.

wrap() takes the unsigned remainder of |i| instead, defined on every backend.
shaders_take_no_signed_remainder parses every shader with naga and fails on a
% whose left operand is a signed integer; it fails on fine.wgsl before this.
2026-11-11 14:40:07 +01:00
Tanish Manku f78ae40e89 feat(doc): colour effect styles as one exact colour transform, rendered, exported and edited everywhere (M2) 2026-11-11 04:50:41 -07:00
Tanish Manku 224fc84012 test(gpu): 9-sliced instances bin like the oracle draws them (M2) 2026-11-11 04:34:52 -07:00
Tanish Manku 3b6f59f65b chore: merge main (GPU binning) into Library management (M2) 2026-11-11 00:11:30 -07:00
Tanish Manku 18b07fffe0 feat(render): bitmaps without Allow Smoothing keep hard pixel edges in the oracle, the GPU stage, SVG and HTML (M2) 2026-11-10 23:43:59 -07:00
Tanish Manku a6df58e30d fix(gpu): as_chunks_mut for the input layout (newer clippy) (M3) 2026-11-10 23:40:02 -07:00
Tanish Manku 750c90edec fix(gpu): a device whose GPU binning fails its self-test bins on the CPU; Auto bins on the GPU on Vulkan only (M3)
The start-up self-test checks the GPU binning apart: if it comes back wrong only the
binning stays on the CPU (gpu_binning_off says why), instead of the whole GPU stage
switching off; the tests require it to work wherever the GPU stage runs (lavapipe in CI).

On Direct3D 12 the binning passes cost more per stage tile than the CPU binning (onion
+-5 at 1080p in tiles: 9.7 -> 14.4 ms, measured twice), so Auto keeps the CPU's there
and on backends not yet measured; ANICRAFT_GPU_BINNING=gpu still forces it.
2026-11-10 20:23:56 -07:00
Tanish Manku ba34521d0c perf(gpu): hairlines reach only the tiles they can touch, and bound in O(1) (M3)
A hairline segment went into every tile within 2 px of it; 1.25 px is enough (a pixel
centre within its reach is within 1 px of a point of it, plus rounding). The room for
its pieces is its padded box's tiles, row by row only for long segments. Onion outlines
against tinted, GPU stage, best of three: 1080p tiles 10.2 vs 9.5 ms, 4K tiles 15.1 vs
15.4 ms, one texture 7.2 vs 7.1 ms.
2026-11-10 20:23:56 -07:00
Tanish Manku f375849413 perf(gpu): upload only the tile headers when the GPU bins, bin from 32,768 edges, cheap hairline rejects (M3)
Mapping the GPU-binned index at creation zeroed and copied its whole room for entries on
the CPU; the headers and op headers now go through the queue and the rest starts zeroed
on the GPU. 50k shapes at 4K, direct: 50 -> 24 ms (CPU-binned: 121 ms).

Auto bins on the GPU from 32,768 edges: forcing it on every 512 px stage tile made the
1,000-shape 4K stage 1.9x slower and the 10k-shape one 1.3x (per-tile pass set-up); with
the threshold the tiled stage never loses (10k at 4K 10.5 -> 10.0 ms, 50k 63.6 -> 38.4 ms).

A hairline segment whose box is out of reach of a pixel is skipped before the distance
(same coverage). gpu_bench compares CPU and Auto binning and checks budgets (--check).
2026-11-10 20:23:56 -07:00
Tanish Manku f18cf5bd68 feat(gpu): tile binning on the GPU: count, prefix sum, scatter, tile lists (M3)
The CPU lays out the fills' points, each fill's tile range, each tile row's fills in
drawing order and room for every tile the fills' bounds cover, with an upper bound of the
pieces, so every buffer is sized up front and nothing is read back. bin.wgsl splits the
edges (one invocation per row of tiles of each fill, so no atomics), scan.wgsl places the
pieces, and a pass per tile keeps the fills with pieces or a backdrop there, in order: the
same lists as the CPU binning, which stays the reference and the way for fills in masks
and groups. Binning::Auto bins on the GPU from 4,096 edges; ANICRAFT_GPU_BINNING overrides.
Tests: the GPU's lists against the CPU's, entry by entry and pixel by pixel (stress
frames, outlines, the analytic scenes), and GPU-binned frames against the oracle, on
Vulkan and Direct3D 12.
2026-11-10 20:23:56 -07:00
Tanish Manku 72da28d74c fix(gpu): keep the binning's helpers private (M3) 2026-11-10 20:23:56 -07:00
Tanish Manku 660bdcb0d8 fix(gpu): take the tiles' left-edge steps from the split pieces themselves (M3)
Crossings computed apart from the splitting could disagree with it by a rounding near a
tile corner and count one crossing twice (the backdrop and a step): 543 pixels off by up
to 133/255 on a stress frame. The steps now come from consecutive pieces of a tile row in
different columns, so the backdrop and the steps always describe the same pieces. A test
on stress frames at awkward scales catches it. Also drops leftover timing prints.
2026-11-10 20:23:55 -07:00
Tanish Manku 0fbf8c5d0f feat(render): hairlines for outline mode, and integer tile backdrops in the GPU binning (M3)
Outline mode (an outlined layer, onion skin's outlines) draws hairlines straight from
the flattened path: coverage 1 - the distance to the nearest segment, one edge per
segment where a stroked hairline was four plus a disc at every bend. Exact for axis-
aligned lines, no darkening at overlaps and joins. The GPU stage computes the same.

The binning's per-row float backdrops become one integer per tile plus a piece on the
tile's left edge wherever the outline crosses it (Vello's backdrops and y-edges), which
lets the GPU compute the same lists without float atomics. Parity unchanged.
2026-11-10 20:23:55 -07:00
Tanish Manku a1482962bc feat(render): stroke caps, joins, miter limit and dashes in the model and the CPU oracle (M7) 2026-11-10 18:41:53 -07:00
Tanish Manku 06c004b294 feat(engine): engine crates build and run on wasm32: vfs file layer, web clocks, single-threaded fallbacks (M8)
Commands read and write files through engine::vfs: std::fs on the desktop, an in-memory
store in the browser that the web shell fills from the file picker and empties into
downloads (ADR 0036). file.open opens .fla bytes through it and gains unsaved?: true for
restored copies. Instant/SystemTime come from web-time; rayon's deferred drops run inline
on wasm; the GPU crate plans layers in turn where wgpu handles aren't Sync; video export
says why it can't run in a browser; system font discovery is native-only.
2026-11-09 22:12:56 -07:00
Tanish Manku 863e8af60a fix(gpu): tests and bench build with merge drawing's Shape.merge; ADR renumbered to 0032 after merge drawing took 0031 (M3) 2026-11-09 20:45:47 -07:00
Tanish Manku 313745b204 feat(gpu): the GPU is the default stage renderer; ADR 0031 (M3)
The shell's gpu-stage feature is on by default and Preferences > Stage >
Renderer defaults to Graphics card (GPU), with the CPU drawing whenever
there is no usable card, a tile is past the GPU's limits or anything
fails. The setting is stored under a new key: every earlier build wrote
the old one as Cpu without anyone choosing it. CI installs lavapipe so the
parity tests run on a software adapter.

Measured (release, RTX 5090): 4K filtered sample 3.9 ms on Vulkan and
4.2 ms on DX12 (CPU 31.5 ms); 200 bitmap fills 4.4 / 4.3 ms (CPU 37.2 ms).
Docs: ADR 0031, performance, roadmap, architecture, CHANGELOG.
2026-11-09 19:48:49 -07:00
Tanish Manku 5bed9916dd fix(gpu): the stage shaders build with Direct3D's FXC; no software adapters for the stage (M3)
FXC must unroll loops that index vector components and could not unroll
blend's and adjust's, so the GPU stage never started on a DX12 window.
Both are vector code now, with the same arithmetic order. The parity
suite passes on DX12 as on Vulkan. A software adapter (WARP, llvmpipe)
is refused for the stage, since the CPU oracle is faster;
GpuRenderer::software() opens one for tests. The self-test now compares
against the oracle (bitmap and filtered symbol included) and says where
it went wrong. The benchmark gains a filtered sample and 200 bitmaps.
2026-11-09 19:48:49 -07:00
Tanish Manku 0dae2056eb feat(gpu): bitmap fills and filters on the GPU stage (M3)
The oracle now hands filtered groups to other renderers as layers
(prepare_scene: Scene::layers, Fill::layer) and resolves each filter into
the exact steps it runs (filters::resolve); apply runs those same steps.
The GPU stage samples bitmaps from textures uploaded once per image
(bilinear by hand, the oracle's colour effect and repeat rules) and draws
each filtered layer, runs its filters as compute passes and composites it
like any fill. Parity: bitmaps byte-identical, filters max 1/255.
2026-11-09 19:48:49 -07:00
Tanish Manku eb85dd2411 feat(gpu): GPU stage draws into the window's textures, no readback; ADR 0029 (M3)
The GPU stage shares eframe's wgpu device (egui_wgpu::RenderState) and
draws each stage tile into a storage texture the shell registers with
egui as it is. Fallbacks: a headless device with readback (window on
OpenGL), then the CPU oracle. Every call runs in thread-local error
scopes; nothing is installed on the window's device; a work bound per
dispatch guards the driver watchdog.

The engine stays GPU-free: Raster::Native carries an opaque image, cached
under its own 384 MB budget; only the shell downcasts it.

perf, gpu_bench on RTX 5090 (Vulkan), 32 threads:
  4K, 1,000 shapes: CPU 16.2-19.6 ms, read-back 8.4, direct 2.1-2.4 ms
  4K, 10k shapes:   CPU 25.8-28.1 ms, read-back 23.2, stage tiles 10.2 ms
  4K, masked 10k:   CPU 74.8-80.0 ms, stage tiles 10.9 ms
Binning stays on the CPU (ADR 0029: not the bottleneck as stage tiles).
2026-11-09 16:58:49 -07:00
Tanish Manku d1627efc0c feat(gpu): masks, nested masks, group alpha and blend modes on the GPU stage (M3)
render::prepare_scene hands the oracle's prepared fills with their clips
(artwork, cleaned parents, bounds) and groups (chains, sanitized alpha,
blend) to the GPU. The binning emits per-tile streams with clip-level and
group open/close entries; fine.wgsl keeps a per-pixel group stack and clip
coverage and blends with the oracle's separable W3C formulas. Parity on
the RTX 5090: max 1/255, mean <= 0.0011/255 on every new scene.

Also a texture entry point (main_texture) and GpuRenderer::shared for the
window's device; render_texture draws without readback.
2026-11-09 16:49:09 -07:00
Tanish Manku 5b431ec1d3 feat(app): Camera tool, camera frame on the stage, Preview Through Camera and the camera toggle (M7)
The stage draws the camera frame in the camera layer's colour; the Camera tool
(C) pans, turns (round handle) and zooms (wheel), one undo step per drag;
View > Preview Through Camera renders stage tiles through the camera; the
timeline header toggles the camera; Properties gets a Camera section and a
layer Depth row. GPU parity and the accessibility audit cover camera scenes.
2026-11-09 12:50:31 -07:00
Tanish Manku d85e398c4a chore: merge main (GPU stage, SVG clips) into variable-width strokes; GPU parity covers width profiles (M7) 2026-11-09 04:17:57 -07:00
Tanish Manku 9173796835 docs: GPU stage ADR is 0019, as assigned by the lead (M3) 2026-11-09 03:44:33 -07:00