Skip to main content

Module tiles

Module tiles 

Source
Expand description

The tile cache: every canvas tile the render, reveal and presentation passes paint, held in engine memory under a working-memory budget with least-recently-used eviction (docs/ARCHITECTURE.md §十 “瓦片缓存”).

The cache never touches storage. When a tile the caller asks for is not resident, the caller makes room: while TileCache::victim names a tile, it stores that tile if it is dirty and only then lets it go with TileCache::evict, so a write that fails leaves the tile cached and dirty for a later flush. It then supplies the new tile’s stored planes, or none for a tile that was never written, with TileCache::insert. Which tiles a flush must write comes from TileCache::dirty; the host encodes and stores them and reports each back with TileCache::saved. Tile pixels are stored raw: encoding them (PNG) is the host’s business.

The clock is the host’s too: a write records the host’s timestamp in Tile::touched, and a periodic flush passes the time of the previous one so tiles still being painted every frame are left for later.

Structs§

StoredTile
What the host read back for a tile it stored earlier. None planes (rows written before that plane existed) start empty, as a fresh tile’s do.
Tile
One resident tile: RGBA pixels and the side planes kept per pixel (coverage, provisional) and per 16×16 block (quality, conflicts, owner frame + 1, score, frozen).
TileCache
The in-memory tile cache.
TileCacheStats
TileKey
Identifies one tile: canvas, pyramid level and tile coordinates. Its storage path is canvas/level/x_y.

Enums§

TileError

Constants§

QUALITY_BLOCK
Side of one quality/ownership block in native pixels.

Functions§

count_covered
Set bits in a coverage bitmap.