Files
Sergio 93253cc227 chore: refresco desde el monorepo — 27 crates nuevos (anim, lottie, svg, mesh, image, layer, test, wire-view, widgets rag-sidebar/router/lazy-list/rive-button) y sync de los 95 existentes
Regenerado con scripts/actualizar-standalone.py --llimphi. Vendoriza además
shared/{foreign-lottie,grafo}. Quedan fuera los crates acoplados al workspace
madre (wasm-*, video-plane, voxel-app/studio, allichay, plugin-host, shuma-term).
cargo check --workspace verde (112 miembros).
2026-07-25 20:57:22 +00:00

1.5 KiB

llimphi-surface

External surfaces inside the Elm loop.

An ExternalSurface is an RGBA8 texture living on the GPU, painted over a rect of the Llimphi frame every time the app exposes it through View::gpu_paint_with. The byte source runs outside the Elm loop: a video decoder, a camera capture, a PDF raster, a raw texture produced by another engine — any producer generating RGBA can push frames with ExternalSurface::upload and see the result on the next raster pass.

The crate provides:

  • ExternalSurface: owner of the texture + render pipeline + bind group. upload(rgba, w, h) uploads bytes and recreates the texture if w/h changed.
  • ExternalSurface::view: a helper that builds a View with gpu_paint_with already wired. The app only chooses the node's Style (which portion of the layout it occupies).

Design

The pipeline is a classic textured quad: two triangles cover the destination rect, and the fragment shader samples the external texture with a bilinear sampler. The quad's NDC coordinates are computed on the GPU from (rect, viewport) travelling through a uniform — which is why the callback needs the viewport that llimphi-ui began propagating in GpuPaintFn.

The intermediate texture Llimphi paints vello into is Rgba8Unorm (see llimphi-hal::INTERMEDIATE_FORMAT). The pipeline emits Rgba8Unorm too — the render pass target is that same intermediate with LoadOp::Load, so the vello background is preserved.


Part of llimphi — see llimphi.