Upstream: crates/rune/README.md § NativeSurface video at
65f8eb43f710, MIT © Anomaly. Bundled by build-rune-apps; links point at this snapshot or at GitHub at that rev.
NativeSurface video
NativeSurface::new() is a cloneable latest-wins frame slot. Bind it with
el().native_surface(&surface, SurfaceFit::Fit) (or Fill), install the app's Waker,
and push retained immutable CoreVideo buffers from a decoder thread. macOS uses
CVMetalTextureCache and wgpu-hal Metal texture import without CPU pixel copies.
BGRA and NV12 420v/420f are supported with BT.601/709 matrices and sRGB/709 transfer
attachments. Pixel-matched video uses exact texel loads at Retina scale.
A window's or overlay's first drawn surface compiles the surface pipeline on a thread of its
own; the surface draws from the frame after it's ready, which the window's live wake asks for.
Headless runs compile it in place.
Per-draw notifications carry source frame ID, CPU submit time, completion-observed time,
and optional GPU render-pass timestamp queries, read only while a drawn surface has an observer
(set_observer): resolving them costs a submission a frame. These are not presented-frame timestamps:
true presentation feedback needs the planned own Mac shell with CAMetalLayer /
CAMetalDisplayLink. wgpu-hal 30 does not expose its acquired drawable, and wgpu 30
forbids mixing normal encoding with the raw command-buffer completed-handler escape
hatch. Completion uses wgpu's per-submission callback/readback, serviced by a sleeping
completion worker so the last frame reports even after the window goes idle.
See examples/video-tiles for the copyable
producer/view boundary, portable byte source, headless benchmark, ownership contract,
colour defaults and current limitations.