19 Commits
Author SHA1 Message Date
shinyobjectz 5c6f2fd63b Stale frame roots dropped in a loop (the retain's closure was another crate's shape, the dupes check) 2026-11-25 00:22:11 -08:00
shinyobjectz 7e09ad474a A stale frame root is dropped by a comparison of its own (a closure of raea gen's shape, the dupes check) 2026-11-25 00:15:13 -08:00
shinyobjectz 420e753583 A closed iframe's frame root goes with its JS, its document and its entity: a page that opened and closed artifacts kept each one's engine running, and a stale root swapped its document into the next iframe given the same id 2026-11-25 00:12:05 -08:00
shinyobjectz ee42e31469 NB2a: stat channels and pass timings chosen and read from TypeScript
io/trace's stats.rs: a stat channel is a RAEA_ variable's name without RAEA_ (bake_trace, trace, bevy_passes), on
when the composition chose it (native("stats.on", { channels }) at its top level), when RAEA_STATS lists it, or when
its variable is set, the override. The 51 reads of 24 trace and stat variables go through raea_io_trace::stat. Each
of Bevy's render passes (RenderDiagnosticsPlugin, on by bevy_passes) and PassTimer's go into the run's totals, with
the counters engine/draws and engine/updates; native("stats.read", {}) returns them, and a run that chose a channel
prints the table and keeps stats.json in its trace folder (docs/manual/reference/cli/traces.md).

tools/nobuild.sh stats checks it: every channel decided done reads through stat(); the scene choosing bevy_passes and
trace traces, reads 9 passes and 11 draws back on its last frame, prints the table and keeps stats.json; with nothing
chosen nothing prints; RAEA_TRACE=1 and RAEA_STATS give the same trace lines. 12 frames take 12 updates.

raea-render's lines stay as they were (NB4a's plugin choice folded to one line). native-calls.ts gains the two calls,
and bevy.app.*, which raea registers now that the macOS build links the plugin catalog.
2026-11-22 09:15:58 -08:00
shinyobjectz b7f796aa5e RT3: a seek while a film plays shows nothing from where it was, and the sound clock moves on between its callbacks and never goes back
The founder, 11-16: timeline playback of plain pre-rendered films is choppy and repeats itself. Three causes were in the window's media path.

A seek made while a film played (the timeline's ruler, its Home key, the next clip of an edited film) left the frames the decoder had already sent for the old place in the page's queue, due by the wall clock, so they could show after the seek's own frame: a stretch shown again, or a step back. The page now drops them when it seeks and keeps none that come while the seek is on its way (keep_due in runtime/dom/media), and a seek that fails no longer holds frames back.

The decoder restarted its clock at the seek's time before it had decoded the frame there (from the keyframe before it: 30 to 300 ms at 4K), so the frames after a slow seek were due at once and skipped to catch up. It now sends the seek's frame first, then starts the clock and plays on from the frame after it (media_play.rs, index_at).

The sound clock was the device's position read at each callback: it stood still between callbacks and jumped a buffer at each (about 11 ms at 48 kHz with 512-frame buffers, a staircase under a 120 Hz page), the output delay subtracted from a fresh reading could put it behind one already read, and a start made during a callback was overwritten by that callback's write. It now runs on from the last callback's position by the time since it, held to what that callback wrote, never earlier than a time already read, and a start made during a callback stands (Shared::time_at in media_sound.rs).

Tests: media_play's a_seek_while_playing_answers_first_and_plays_on_from_there (a 3 s clip played past 1.2 s, seeked to 0.5: the seek's frame answers, then ten frames in order from 16/30 with none skipped, the first due a frame after the answer); media_sound's the_clock_moves_between_callbacks, a_late_callback_holds_the_clock, a_start_during_a_callback_stands and the_delay_never_takes_it_back; runtime/dom/media's frames_decoded_before_a_seek_are_not_kept. With RAEA_AUDIO_MUTE=1 the clock is the wall clock, so the sound clock's change is held by its unit tests, not by the headless play bench (the app's e2e/playback.spec.ts, docs/realtime.feature RT3).
2026-11-16 17:29:57 -08:00
shinyobjectz 4b1cb9ec9a A page's JS engine gives its free pages back every 5 s, and with RAEA_INSPECT its heap is logged and JavaScriptCore's context inspectable
The page loop (raea-runtime-dom's host step) never asked JavaScriptCore to release what it had freed, so the app
window's JS memory (WebKit Malloc) grew 272 to 448 MB over an hour of use while the live heap stayed ~60 MB. Upkeep
(raea-runtime-jsengine) releases it every RAEA_JSC_RELEASE_S (5; 0 never), as raea-runtime-react's thread already did:
the same window then held 166 MB flat.

RAEA_INSPECT=1: every RAEA_JS_HEAP_S (30) a full collection, then one JSON line of the heap's numbers in
~/.raea/logs/js-heap-<pid>-<n>.jsonl (JavaScriptCore's JSGetMemoryUsageStatistics, QuickJS's memory usage), so what a
page keeps can be read over a session on any engine; and on JavaScriptCore the context is inspectable from Safari's
Develop menu. Off by default (the collection stops the page's thread for 6-13 ms).
2026-11-16 16:29:45 -08:00
shinyobjectz f9b6f22ecf media: a quarter second of frames waits ahead; a video drawn small sends only the halving it is drawn from 2026-11-13 11:43:31 -08:00
shinyobjectz d7a755c08b Video plays smoothly at 4K and at 60 fps: frames decoded ahead and shown when due, a faster BGRA conversion, halvings from the decoder's thread, no relayout for a same-size frame 2026-11-13 11:43:31 -08:00
shinyobjectz df9d1d11d5 media: a playing video's frames leave its decoder when they fall due; RAEA_MEDIA_STATS says how play goes (measured: raea-feed d55df57) 2026-11-13 09:03:44 -08:00
Luke, I am your fatherandshinyobjectz ea741f6bef Page: give Blitz its viewport in device pixels (a Retina window's interface sits in a quarter of it) (#120)
* Page: Blitz's viewport is in device pixels, so a page at scale 2 fills its image (#119)

a78fb95 gives the app window's page the display's scale. With a scale other than 1, raea-sys-page still gave
Blitz a viewport whose window_size was the page's size in points. Blitz's window_size is in device pixels (it
divides by hidpi_scale for the CSS viewport), as the page's image and paint_scene already are, so on a Retina
display the interface was sharp but laid out in the top-left quarter of the window.

Page::px is the page's size in device pixels, used for the image, the paint and the viewport.

Nothing changes at scale 1.

* Page: the page's JS and its element list read the viewport in CSS px, and devicePixelRatio is the page's scale

With Blitz's viewport in device pixels, two readers of window_size in runtime/dom still took it for CSS px.
snapshot sent it as vw and vh with dpr 1, so at scale 2 innerWidth and matchMedia answered twice the width the
page is laid out at; elements tested boxes against a window twice the size, so elements up to a window's width
off screen were listed as visible. Both read the viewport's logical size now, and dpr is its scale.

tests/viewport.rs: a page at scale 2 lays a 100vw x 100vh element out at its size in CSS px; scale 1 is as it
was; a fractional scale rounds the image up.

Rebased onto main at 6da2995: main's LR1 (7fb2194) moved the layout snapshot into raea-sys-page (systems/page/src/snapshot.rs, snapshot_by, which a composition's page.layout answers too), so the vw, vh and dpr change is made there, and elements.rs re-exports it.

* Page tests: q and attr live in tests/common, which vars.rs and viewport.rs both use, not one copy each (dupes back to 293)

---------

Co-authored-by: shinyobjectz <[email protected]>
2026-11-12 19:48:36 -05:00
shinyobjectz ebff73dbc6 LR6, LR7: the canvas's text natives (measure, advances, svgText) are each a function of the fonts (raea_sys_canvas::TextNative), registered from one table and given the page's fonts by with_page_fonts, instead of three wrappers that did it alike; canvas.read's rectangle and svgText's tracking read without closures that copied raea-runtime-sound's (dupes back to 293/59)
Skills: SKILL.md's 7. Deliver (sources: runtime/export/src) checked, still true: the export's change only passes page.layout's request through.
2026-11-12 16:26:53 -08:00
shinyobjectz 7fb2194503 LR1: A composition reads its layout synchronously from the page that draws its frame (#54). Its JS asks page.layout and blocks; settle wakes on the ask as on a flush, applies the commits already sent, and the host lays its page out at the frame's time and answers every element's boxes at once, keyed by React id: raea-sys-page's snapshot (now runtime/dom's too), with offsets from blitz-dom's offset_rect and offsetParent. settle_with takes the host's answer; plain settle says the host lays no page out. Each runtime has its own ask (a render's 3D pre-pass and a bake's workers run beside it). The still, 3D and fed renders answer from their page; the sound pass and the 3D rows' pre-pass answer no boxes. sdk/raea's page-layout keeps the answer until the next commit or frame, so a composition that never reads makes no snapshot 2026-11-12 13:54:53 -08:00
shinyobjectz 75b1c69e71 A page's <video> and <audio> play at their element's volume in raea's window (Shane 11-10: 'a loudness lever not just on and off'). sdk/ui's element takes volume as a browser's does (0..1, RangeError outside it, volumechange) and tells the host __volume, again with each play; runtime/dom/media asks the decoder Cmd::Volume when it changes; raea-runtime-js keeps it per player and plays the sound at that gain while it isn't muted (an AtomicU32 beside muted, read in the audio callback), set again when a sound opens. Before this the window had only muted, so the app's volume slider changed nothing. sdk/ui test: the element's volume reaches the host as __volume, fires volumechange once and is told again with a play. The live composition stage has no volume call yet 2026-11-10 16:16:08 -08:00
shinyobjectz e1b7a97ebd Video playback without the hitch every 300 frames: the Mac decoder's reader is recycled at a keyframe play has reached (a cursor stepped back to it, nothing decoded), so it no longer decodes a GOP first; frame 299 went from 46 ms (1080p60) and 163 ms (4K30, 250-frame GOPs) to about 20 ms at the next keyframe, open-GOP HEVC too, every frame's time checked (io/apple/tests/play_timing.rs). The page's video picture shares the frame's pixels instead of copying them again (Shane 11-09: playback starts to get weird) 2026-11-09 21:05:42 -08:00
shinyobjectz d3e2922058 Page media in its own crate, raea-runtime-dom-media (runtime/dom/media), so raea-runtime-dom stays under the crate limit (L1 size: 2049 lines); its copies folded
The video and audio elements' sync moves out of raea-runtime-dom as it was, and raea-runtime-dom re-exports it as media. raea-sys-image and vello were only media's and go with it. Stream's four one-line senders are now one ask(Cmd), with Cmd public (L1 dupes: seek and muted were one shape). A seek that has landed is Media::landed, which is checked from two places. Tests: raea-runtime-js, raea-runtime-dom and the new crate pass; raea-cli checks.
2026-11-09 12:39:13 -08:00
shinyobjectz f8844bb385 Page media plays: video and audio elements' play(), pause() and load() drive the host's player, on the sound's clock
The desktop app's watch player threw on play() (the page runtime's <video> had none: the host played nothing), and
going back from an item crashed the app (its preload cleanup called load()). Now raea-runtime-js media_play.rs plays a
source on its decoder's thread: frames asked for at the clock's time (a slow decode skips frames, never lags), the
clock the sound's, out of the default device through cpal (media_sound.rs; muted plays silence on it), so picture and
sound can't drift; the wall's with no device or RAEA_AUDIO_MUTE=1. runtime/dom media.rs passes __play, __muted and
__load and tells playing, time (each frame), timeupdate (4 a second) and ended. sdk/ui dom/media.ts: play() (a
Promise), pause(), load(), paused, ended, loop, autoplay, canPlayType, preload, readyState per source, a new src
pausing as a browser's does; dom/host.ts gives React's onPlay, onPause, onPlaying, onTimeUpdate, onEnded, onCanPlay,
onVolumeChange and onEmptied their events. Tests: media_play::tests (wall clock: order, end on time, exact seek,
loop, pause), sdk/ui dom.test.tsx's media case (51 pass).
2026-11-09 12:31:56 -08:00
shinyobjectz ee771c453c T6c: Rune layers in a Blitz page: what's under data-raea-renderer="rune" (sdk/rune's <RuneLayer>) is drawn by Rune on Bevy's device and shown in its slot
raea-runtime-dom's commits pass through a split (set_split), where raea-rune-layer's Router takes each layer's ops out of the batch in the JS's order, the slot standing for the layer page's root; a page that never makes a slot isn't routed. raea-rune-slots keeps each layer as a raea-rune-page Page in a raea-rune-bevy Tree (its new before_frame hook takes the routed ops), sized each frame to its slot's content box at the page's scale and shown there through ElementImages. Pointer input reaches it through the slot twin's picking events, a held press capturing the pointer as setPointerCapture does; its page's events reach the root's JS (deliver_to). raea-page-host adds it (RAEA_RUNE_LAYERS=0: all Blitz). Said, not dropped: a move between the page and a layer, and that a layer's elements aren't in the layout snapshot. vendor/rune-taffy: Rune and Blitz in one build need taffy's flexbox_balance arms in encode_wrap. Tests (engine/rune/slots/tests/slot.rs, through the page host): the slot's subtree is the layer's and not Blitz's, the layer is the slot's size and shown there, a press reaches the page's JS, and a press released off the layer still ends there; mutants without the split, the deliveries or the capture each fail one. The skill says how to use <RuneLayer> and what it doesn't do yet.
2026-11-07 15:20:38 -08:00
shinyobjectz 1dff4f0aa8 raea e699cf684509a8bbada118cc302c56e99065a680 2026-11-05 17:19:37 -08:00
shinyobjectz f675b0ad2b raea dc579e418 2026-10-31 13:15:29 -07:00