Module strip_layers
Expand description
A frame drawn as retained layers, and strip pans composited from them.
A frame producer whose content holds horizontally panned strips (a wide
canvas seen through a viewport) can draw the frame as layers
(FrameLayers): what is behind every strip, each strip on its own in
canvas coordinates, and everything above them, all in scene (device)
pixels. A pan then changes only where each strip reads its canvas
(StripBlit::scroll_x); the layers’ scenes stay byte for byte the same.
StripLayers keeps the backdrop, the strips and the chrome rasterised in
textures of the output’s size. The strips texture holds the strips as the
screen shows them (append_panned). On a pure pan, a pixel whose strips all moved by the
same distance is copied from where it was, and only the rest is
rasterised: the columns the pan uncovered, and the bands where a moving
strip’s drawing meets a strip that moved otherwise (each strip draws its
shadows past its row, into its neighbour’s). The output is then composited
from the three textures (source over, premultiplied, as vello blends), over
what changed. The backdrop and the chrome are rasterised again only when
their scenes change.
The composite stores straight alpha, as vello’s fine stage does, so a composited output matches a single render of the same frame within a channel step of rounding.
Structs§
- Band
Copy - Part of the strips layer that a pan moves:
width × heightpixels at(src_x, src_y)go to(dst_x, dst_y). - Chrome
Damage - Where the chrome of a drawing as layers differs from the chrome of the
drawing
since(FrameCache::generation), in scene pixels and whole 16-pixel tiles: a presenter whose chrome texture still holds that drawing’s chrome brings it up to date by rasterising only these rects, so a clock tick rasterises a few tiles, not the whole layer. - Composite
Target - Where a composite is encoded and what it writes.
- Frame
Cache - A frame as layers a presenter retains between frames.
- Frame
Layers - A frame’s sections as layers, bottom to top, in scene pixels. Drawing
them over each other in order (source over) gives the frame’s scene
(
compose), so a presenter can rasterize each into its own retained buffer and composite the buffers: a strip’s pan then moves that strip’s pixels over a backdrop and chrome that stay put, without drawing any of them again. - Layer
Presenter - The layer textures of one output and what they hold.
- Layer
Recording - One frame drawn as layers, on this thread, from
Self::beginuntilSelf::finish(or the guard’s drop, which discards it). - Layer
Texture - One layer’s texture: what vello rasterises into and the composite reads.
- Layer
Work - The work a frame takes: which layers to rasterise, and where to composite the output.
- Queued
Raster - The raster an app’s render worker presents layers with: vello renders each layer straight into its texture and the composite writes the worker’s retained target, all submitted in order on one queue, so nothing waits for the GPU here; presenting the target follows them.
- Shown
- What a set of layer textures shows: the layers of the frame last
composited from them, or warmed into them at rest
(a presenter warming its textures between pans). A
layer is
Nonewhile its texture holds nothing known: a warm stopped while drawing it. - Strip
Blit - A strip drawn in canvas coordinates. The presenter shows the strips
layer
scroll_xpixels to the right of andscroll_ypixels belowdest_*, in scene pixels. - Strip
Layers - The retained layers of one output, and the pass that composites them.
Enums§
- Layer
- Which layer texture a render goes to.
- Workspace
Work - What the strips layer needs for a frame.
Traits§
- Layer
Raster - What a
LayerPresenterrasterises with and composites through.
Functions§
- append_
panned - The strips layer as the screen shows it: what no strip carries in place,
then each strip, top to bottom, inside its destination read
scroll_xpixels to the right of andscroll_ypixels below it. - chrome_
damage - Where the chrome texture, holding
shown’s chrome, must be rasterised again to holdcache’s, on an output ofsize: the rectsFrameCache::chrome_damagenames, when the texture holds the drawing they were measured from.Nonewhen that is not known: the whole layer. - compose
- The frame
cacheholds as one scene: its layers over each other, asStripLayerscomposites them. - draw_
strip - Draw a pannable view’s content as the frame’s strip, when a
LayerRecordingis open:viewport(where the content shows) andscroll(how far it is panned,transformmapping both to device pixels) are whole device pixels, nothing is open around the view inscene, and no other view is the frame’s strip.drawthen draws the content where it would show with no pan,scrollright of and below where it shows: the strip’s canvas. Returnsfalse, having drawn nothing, otherwise: the caller draws its content as usual. - plan
- The work that brings layer textures showing
showntocache, on an output ofsize.output_currentsays the output target still holdsshown’s composite, so only what changed needs compositing again. - put_
under - Put what
cachedraws under its chrome below every surface ofbackdrop: a floating surface drawn in the chrome recorded only the chrome drawn before it as what is behind it. - take_
panned - Whether a view that can be drawn as a strip (
draw_strip) panned in a frame drawn since the last call: a host draws the next frame as layers. - tiles
damage(device pixels) on an output ofsizein whole 16-pixel tiles, asChromeDamage::rectsnames where a chrome changed.- warm_
bands - The bands a warm rasterises a whole layer of an output of
sizein, top to bottom;Nonewhen one render takes the whole layer.