diff --git a/src/data/program_configuration.js b/src/data/program_configuration.js index 5b1bfc5085f..b3b32a94eaf 100644 --- a/src/data/program_configuration.js +++ b/src/data/program_configuration.js @@ -534,23 +534,19 @@ export default class ProgramConfiguration { } } - updatePatternPaintBuffers(crossfade: CrossfadeParameters) { - const buffers = []; + updatePaintBuffers(crossfade?: CrossfadeParameters) { + this._buffers = []; for (const property in this.binders) { const binder = this.binders[property]; - if (binder instanceof CrossFadedCompositeBinder) { + if (crossfade && binder instanceof CrossFadedCompositeBinder) { const patternVertexBuffer = crossfade.fromScale === 2 ? binder.zoomInPaintVertexBuffer : binder.zoomOutPaintVertexBuffer; - if (patternVertexBuffer) buffers.push(patternVertexBuffer); - } else if ((binder instanceof SourceExpressionBinder || - binder instanceof CompositeExpressionBinder) && - binder.paintVertexBuffer - ) { - buffers.push(binder.paintVertexBuffer); + if (patternVertexBuffer) this._buffers.push(patternVertexBuffer); + + } else if ((binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder) && binder.paintVertexBuffer) { + this._buffers.push(binder.paintVertexBuffer); } } - - this._buffers = buffers; } upload(context: Context) { @@ -559,18 +555,7 @@ export default class ProgramConfiguration { if (binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder || binder instanceof CrossFadedCompositeBinder) binder.upload(context); } - - const buffers = []; - for (const property in this.binders) { - const binder = this.binders[property]; - if ((binder instanceof SourceExpressionBinder || - binder instanceof CompositeExpressionBinder) && - binder.paintVertexBuffer - ) { - buffers.push(binder.paintVertexBuffer); - } - } - this._buffers = buffers; + this.updatePaintBuffers(); } destroy() { diff --git a/src/render/draw_fill.js b/src/render/draw_fill.js index 3f96530448b..7f673f944d4 100644 --- a/src/render/draw_fill.js +++ b/src/render/draw_fill.js @@ -87,7 +87,7 @@ function drawFillTiles(painter, sourceCache, layer, coords, depthMode, colorMode if (image) { painter.context.activeTexture.set(gl.TEXTURE0); tile.imageAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE); - programConfiguration.updatePatternPaintBuffers(crossfade); + programConfiguration.updatePaintBuffers(crossfade); } const constantPattern = patternProperty.constantOr(null); diff --git a/src/render/draw_fill_extrusion.js b/src/render/draw_fill_extrusion.js index 07076bc3977..ebc4bf576f4 100644 --- a/src/render/draw_fill_extrusion.js +++ b/src/render/draw_fill_extrusion.js @@ -66,7 +66,7 @@ function drawExtrusionTiles(painter, source, layer, coords, depthMode, stencilMo if (image) { painter.context.activeTexture.set(gl.TEXTURE0); tile.imageAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE); - programConfiguration.updatePatternPaintBuffers(crossfade); + programConfiguration.updatePaintBuffers(crossfade); } const constantPattern = patternProperty.constantOr(null); diff --git a/src/render/draw_line.js b/src/render/draw_line.js index 481dff0b80c..c9939941e5b 100644 --- a/src/render/draw_line.js +++ b/src/render/draw_line.js @@ -81,7 +81,7 @@ export default function drawLine(painter: Painter, sourceCache: SourceCache, lay if (image) { context.activeTexture.set(gl.TEXTURE0); tile.imageAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE); - programConfiguration.updatePatternPaintBuffers(crossfade); + programConfiguration.updatePaintBuffers(crossfade); } else if (dasharray && (programChanged || painter.lineAtlas.dirty)) { context.activeTexture.set(gl.TEXTURE0); painter.lineAtlas.bind(context);