# 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](../README.md).