From dce6e7657e7d756f92a22dcb65668a8cdb94231f 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 be2b12db161..5e9ebdc6127 100644 --- a/src/render/draw_hillshade.js +++ b/src/render/draw_hillshade.js @@ -75,6 +75,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); @@ -83,7 +84,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 });