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§
- Stored
Tile - What the host read back for a tile it stored earlier.
Noneplanes (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).
- Tile
Cache - The in-memory tile cache.
- Tile
Cache Stats - TileKey
- Identifies one tile: canvas, pyramid level and tile coordinates. Its storage path is
canvas/level/x_y.
Enums§
Constants§
- QUALITY_
BLOCK - Side of one quality/ownership block in native pixels.
Functions§
- count_
covered - Set bits in a coverage bitmap.