Skip to main content

Module atlas

Module atlas 

Source
Expand description

Whether a drawing’s images fit the GPU, and where. vello copies every image a frame paints into one atlas texture, at most SIDE pixels a side, and an image that finds no room there is silently left out of the frame. So the engine asks this model first, and a drawing whose images don’t fit is the design’s problem rather than a picture with holes.

The model is vello_encoding’s own image cache (0.11, image_cache.rs and Resolver::resolve_pending_images) run on a fresh cache, with the same guillotiere allocator: images placed in the order the frame first uses them, the atlas starting at [START] and doubling, everything placed so far repacked in blob order at each size, until SIDE. The canvas keeps a vello renderer — and so its atlas — only while the drawings it renders paint the very same blobs, in the same order: the atlas then holds those images and nothing else, placed as a fresh one would place them. Any other drawing gets a fresh renderer. The engine makes each drawing’s new blobs in the order it first uses them, so blob order is that order on every machine. A test in the module runs vello’s own resolver on the same images and holds the two to the same fit and the same places.

Constants§

SIDE
The atlas’s largest side, vello_encoding’s MAX_ATLAS_SIZE.

Functions§

place
Places images — each a (width, height), distinct, in the order a frame first paints them — as vello does in a fresh atlas, and gives each one’s top-left corner there. Err is the index of the first image it leaves out.