Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache hillshade textures based on texture size, not tile size. #7691

Merged
merged 1 commit into from
Dec 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/render/draw_hillshade.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function prepareHillshade(painter, tile, layer, sourceMaxZoom, depthMode, stenci
// base 2 - 0000 0000, 0000 0001, 0000 0110, 1110 1100
if (tile.dem && tile.dem.data) {
const tileSize = tile.dem.dim;
const textureStride = tile.dem.stride;

const pixelData = tile.dem.getPixels();
context.activeTexture.set(gl.TEXTURE1);
Expand All @@ -88,7 +89,7 @@ function prepareHillshade(painter, tile, layer, sourceMaxZoom, depthMode, stenci
// tiles will appear blank, because as you can see above the alpha value for these textures
// is always 0
context.pixelStoreUnpackPremultiplyAlpha.set(false);
tile.demTexture = tile.demTexture || painter.getTileTexture(tile.tileSize);
tile.demTexture = tile.demTexture || painter.getTileTexture(textureStride);
if (tile.demTexture) {
const demTexture = tile.demTexture;
demTexture.update(pixelData, { premultiply: false });
Expand Down