From d7d6a66cd23c375ea558a0510aa33e3de243747b Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Wed, 12 Dec 2018 11:05:37 -0800 Subject: [PATCH] Cache hillshade textures based on texture size, not tile size. Fixes #7690 -- hillshade layers leak GPU memory. --- src/render/draw_hillshade.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/render/draw_hillshade.js b/src/render/draw_hillshade.js index a16ae8df277..81426847fc1 100644 --- a/src/render/draw_hillshade.js +++ b/src/render/draw_hillshade.js @@ -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); @@ -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 });