Hello! As part of investigating #4311, I noticed that in some cases the source cache size for raster tiles may be set incorrectly.
Load this jsbin that includes a raster source; I've reproduced this on both retina and non-retina displays, using Chrome on macOS
Open the console to see that the actual cache size is too small for the number of tiles
mapbox-gl-js version: 0.32.1
The cache should be able to accommodate 5 zoom levels of tiles (if I'm interpreting the line const commonZoomRange = 5; correctly)
The cache only accommodates ~1.5 zoom levels of tiles. SourceCache#updateCacheSize is using transform.tileSize, which has a value of 512px, when the tiles are actually 256px. As a result, it thinks that 1/4 as many tiles are being rendered.
Am I correct that the intent in SourceCache is to cache 5 zoom levels of tiles?
From what I can tell, this issue only affects raster sources, not vector sources (here's a vector jsbin for reference). Even with the limited cache size, the map still functions pretty well, so I don't think there's any rush to fix this before #2291 is complete.
Good catch! We fixed the equivalent bug in mapbox-gl-native in https://github.com/mapbox/mapbox-gl-native/commit/44b960fb925a5a2bf290dd4dab442e58d000dde2.
Most helpful comment
Good catch! We fixed the equivalent bug in mapbox-gl-native in https://github.com/mapbox/mapbox-gl-native/commit/44b960fb925a5a2bf290dd4dab442e58d000dde2.