Skip to content

fix(deck.gl-geotiff)!: remove maxCacheByteSize from MosaicLayer - #843

Merged
kylebarron merged 2 commits into
mainfrom
kyle/mosaic-drop-max-cache-byte-size
Nov 5, 2026
Merged

kylebarron merged 2 commits into
mainfrom
kyle/mosaic-drop-max-cache-byte-size

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

This PR was written by Claude (Claude Code), not by @kylebarron.

MosaicLayer no longer takes maxCacheByteSize. Setting it never bounded the cache: an item's cached content reports no byteLength, so deck.gl's byte count became NaN, and the cache grew without limit (#803).

Since #839, MosaicLayer's cache holds only the items' opened sources. A byte budget on a mosaic reads as the memory of its items' layers. But those layers keep their tiles in their own caches, and only for items in view, so MosaicLayer's cache can't bound them. In deck.gl's TileLayer, maxCacheSize and maxCacheByteSize bound the same cache; in MosaicLayer they would bound two different ones.

A budget across the items' layers needs one tile cache that they all share, evicting the oldest hidden tiles across items. That belongs with the CPU/GPU split in #516.

Migration

  • maxCacheSize still sets how many items keep their opened source in the cache. By default, that's five times the items in view.
  • To bound an item's memory by bytes, set maxCacheByteSize on the layer that renderSource returns. COGLayer's default pipeline reports each tile's texture bytes. A custom getTileData must return a byteLength for it to work.
renderSource: (item, { source, subLayerProps }) =>
  new COGLayer({ ...subLayerProps, source, maxCacheByteSize: 16 * 2 ** 20 }),

Changes

  • MosaicLayerProps no longer picks maxCacheByteSize from TileLayerProps, and MosaicLayer no longer passes it to its inner TileLayer. A comment next to the existing debounceTime note says why.
  • Spec: decision 17 records the removal, and the MosaicLayer section no longer proposes that sources report a byteLength.

Tests

  • A type test checks that new MosaicLayer({ maxCacheByteSize }) doesn't typecheck. It failed before the change.
  • All 217 deck.gl-geotiff tests pass, as do the workspace typecheck and Biome.

Closes #803

🤖 Written by Claude Code

kylebarron and others added 2 commits November 5, 2026 10:20
It never bounded the cache: an item's cached content reports no
byteLength, so deck.gl's byte count became NaN and the cache grew without
limit. Since MosaicLayer's cache holds only opened sources, a byte budget
for a mosaic would have to count its items' layers, whose tiles live in
their own caches. maxCacheSize still bounds how many items keep a source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅

@kylebarron
kylebarron merged commit 38662d7 into main Nov 5, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/mosaic-drop-max-cache-byte-size branch November 5, 2026 15:26
kylebarron added a commit that referenced this pull request Nov 5, 2026
> [!NOTE]
> This PR was written by Claude (Claude Code), not by @kylebarron.

Bumps `version` to `0.10.0-beta.3` in the root `package.json` and in
every `packages/*/package.json`. The publish workflow publishes it under
the `beta` dist-tag, so `latest` stays on 0.9.0.

`CHANGELOG.md` gets a `v0.10.0-beta.3` section with GitHub's generated
notes for the 17 PRs merged since v0.10.0-beta.2.

## Breaking change

- #843: `MosaicLayer` no longer takes `maxCacheByteSize`. To bound an
item's memory by bytes, set `maxCacheByteSize` on the layer that
`renderSource` returns.

## Behavior changes

- #839: a `MosaicLayer` item out of view keeps its opened source in the
cache but drops its layers, which frees their textures.
- #785: `parseGeoZarrMetadata` takes Y from the first entry of
`spatial:dimensions` and X from the second, whatever their names, as
v0.1 of the spatial convention says. Lists that aren't two entries long
are rejected.
- #841: `RasterTileset2D.getParentIndex` picks the parent tile that
contains the child's centre.

## New APIs

- #835: `parseVRT` in `@developmentseed/deck.gl-geotiff`, and `fromGDAL`
in `@developmentseed/affine`.
- #789: `renderSource` gets the props that `MosaicLayer` passes to its
sublayers.

## Not included

#838 (`ZarrSource` opens from a store with a `path`) and #837
(`DEFAULT_RANGE_READER` moves to `@developmentseed/deck.gl-raster`) are
still open. Both are breaking.

🤖 Written by [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MosaicLayer's maxCacheByteSize leaves its cache unbounded

1 participant