diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-08-16 12:03:53 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2020-02-14 17:34:00 +0200 |
commit | a876c965a55213f38b91303c81239fbda0a9f7da (patch) | |
tree | 3189f7cd15c0633a54b8220550ab3e8b28e50a75 /src/mbgl/renderer/paint_parameters.cpp | |
parent | 189ed4aac362f7122e0889cdb9c7fc6580d24392 (diff) | |
download | qtlocation-mapboxgl-a876c965a55213f38b91303c81239fbda0a9f7da.tar.gz |
[core] Store SegmentVectors in ephemeral render objects
We used some shared SegmentVectors, e.g. for drawing raster or background tiles.
In longer running maps, this lead to resource accumulation. By storing the SegmentVectors
and the contained gfx::DrawScope objects, we ensure that resources get released
when the associated render objects vanish.
Diffstat (limited to 'src/mbgl/renderer/paint_parameters.cpp')
-rw-r--r-- | src/mbgl/renderer/paint_parameters.cpp | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/src/mbgl/renderer/paint_parameters.cpp b/src/mbgl/renderer/paint_parameters.cpp index 6c6abc008b..b2f958b14e 100644 --- a/src/mbgl/renderer/paint_parameters.cpp +++ b/src/mbgl/renderer/paint_parameters.cpp @@ -129,39 +129,30 @@ void PaintParameters::renderTileClippingMasks(const RenderTiles& renderTiles) { const int32_t stencilID = nextStencilID++; tileClippingMaskIDs.emplace(renderTile.id, stencilID); - program.draw( - context, - *renderPass, - gfx::Triangles(), - gfx::DepthMode::disabled(), - gfx::StencilMode { - gfx::StencilMode::Always{}, - stencilID, - 0b11111111, - gfx::StencilOpType::Keep, - gfx::StencilOpType::Keep, - gfx::StencilOpType::Replace - }, - gfx::ColorMode::disabled(), - gfx::CullFaceMode::disabled(), - *staticData.quadTriangleIndexBuffer, - staticData.tileTriangleSegments, - program.computeAllUniformValues( - ClippingMaskProgram::LayoutUniformValues { - uniforms::matrix::Value( matrixForTile(renderTile.id) ), - }, - paintAttributeData, - properties, - state.getZoom() - ), - program.computeAllAttributeBindings( - *staticData.tileVertexBuffer, - paintAttributeData, - properties - ), - ClippingMaskProgram::TextureBindings{}, - "clipping/" + util::toString(stencilID) - ); + program.draw(context, + *renderPass, + gfx::Triangles(), + gfx::DepthMode::disabled(), + gfx::StencilMode{gfx::StencilMode::Always{}, + stencilID, + 0b11111111, + gfx::StencilOpType::Keep, + gfx::StencilOpType::Keep, + gfx::StencilOpType::Replace}, + gfx::ColorMode::disabled(), + gfx::CullFaceMode::disabled(), + *staticData.quadTriangleIndexBuffer, + staticData.clippingMaskSegments, + program.computeAllUniformValues( + ClippingMaskProgram::LayoutUniformValues{ + uniforms::matrix::Value(matrixForTile(renderTile.id)), + }, + paintAttributeData, + properties, + state.getZoom()), + program.computeAllAttributeBindings(*staticData.tileVertexBuffer, paintAttributeData, properties), + ClippingMaskProgram::TextureBindings{}, + "clipping/" + util::toString(stencilID)); } } |