Mapbox-gl-js: Raster source cache size is incorrectly set

Created on 22 Feb 2017  路  1Comment  路  Source: mapbox/mapbox-gl-js

Hello! As part of investigating #4311, I noticed that in some cases the source cache size for raster tiles may be set incorrectly.

To reproduce:

  1. Load this jsbin that includes a raster source; I've reproduced this on both retina and non-retina displays, using Chrome on macOS

  2. 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

Expected Behavior

The cache should be able to accommodate 5 zoom levels of tiles (if I'm interpreting the line const commonZoomRange = 5; correctly)

Actual Behavior

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.

bug

Most helpful comment

Good catch! We fixed the equivalent bug in mapbox-gl-native in https://github.com/mapbox/mapbox-gl-native/commit/44b960fb925a5a2bf290dd4dab442e58d000dde2.

>All comments

Good catch! We fixed the equivalent bug in mapbox-gl-native in https://github.com/mapbox/mapbox-gl-native/commit/44b960fb925a5a2bf290dd4dab442e58d000dde2.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamdenny picture iamdenny  路  3Comments

rigoneri picture rigoneri  路  3Comments

PBrockmann picture PBrockmann  路  3Comments

muesliq picture muesliq  路  3Comments

stevage picture stevage  路  3Comments