Commit 9480a26
perf(raster-tileset): Reduce re-renders of RasterLayer for same per-tile transforms (#543)
* perf(raster-tileset): attach per-tile forward/inverse transforms to TileMetadata
`AffineTilesetLevel.tileTransform` and `TileMatrixAdaptor.tileTransform`
each constructed two new arrow functions per call. `RasterTileLayer.
_renderSubLayers` invoked them per tile on every render, so the returned
references churned constantly. That instability tripped
`reprojectionFnsChanged` in `RasterLayer.updateState`, which re-ran
`_generateMesh`, which produced a fresh `state.mesh` wrapper, which tripped
`props.mesh !== oldProps.mesh` in `SimpleMeshLayer.updateState`, which
destroyed and rebuilt the GPU `Model` — incurring full shader assembly per
tile per render.
Move transform computation upstream into `RasterTileset2D.getTileMetadata`,
which deck.gl calls once per tile at construction time. The resulting
forward/inverse functions live on the tile's metadata, so consumers receive
the same references across all renders for the tile's lifetime. When the
tile is evicted from `TileLayer`'s cache, the transforms go with it —
lifetime is automatically correct, and the cache size tracks
`TileLayer.maxCacheSize` rather than growing unbounded.
`_renderSubLayers` now reads `tile.forwardTransform` / `tile.inverseTransform`
instead of recomputing per render.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* More concise
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3e05a59 commit 9480a26
3 files changed
Lines changed: 80 additions & 6 deletions
File tree
- packages/deck.gl-raster
- src
- raster-tile-layer
- raster-tileset
- tests/raster-tileset
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
389 | 386 | | |
390 | 387 | | |
391 | 388 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
58 | 77 | | |
59 | 78 | | |
60 | 79 | | |
| |||
253 | 272 | | |
254 | 273 | | |
255 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
256 | 278 | | |
257 | 279 | | |
258 | 280 | | |
| |||
269 | 291 | | |
270 | 292 | | |
271 | 293 | | |
| 294 | + | |
| 295 | + | |
272 | 296 | | |
273 | 297 | | |
274 | 298 | | |
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments