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/sources | |
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/sources')
-rw-r--r-- | src/mbgl/renderer/sources/render_image_source.cpp | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp index 6d197df9db..30f1bbcee6 100644 --- a/src/mbgl/renderer/sources/render_image_source.cpp +++ b/src/mbgl/renderer/sources/render_image_source.cpp @@ -36,33 +36,25 @@ void ImageSourceRenderData::render(PaintParameters& parameters) const { auto& programInstance = parameters.programs.debug; for (auto matrix : matrices) { - programInstance.draw( - parameters.context, - *parameters.renderPass, - gfx::LineStrip { 4.0f * parameters.pixelRatio }, - gfx::DepthMode::disabled(), - gfx::StencilMode::disabled(), - gfx::ColorMode::unblended(), - gfx::CullFaceMode::disabled(), - *parameters.staticData.tileBorderIndexBuffer, - parameters.staticData.tileBorderSegments, - programInstance.computeAllUniformValues( - DebugProgram::LayoutUniformValues { - uniforms::matrix::Value( matrix ), - uniforms::color::Value( Color::red() ) - }, - paintAttributeData, - properties, - parameters.state.getZoom() - ), - programInstance.computeAllAttributeBindings( - *parameters.staticData.tileVertexBuffer, - paintAttributeData, - properties - ), - DebugProgram::TextureBindings{}, - "image" - ); + programInstance.draw(parameters.context, + *parameters.renderPass, + gfx::LineStrip{4.0f * parameters.pixelRatio}, + gfx::DepthMode::disabled(), + gfx::StencilMode::disabled(), + gfx::ColorMode::unblended(), + gfx::CullFaceMode::disabled(), + *parameters.staticData.tileBorderIndexBuffer, + parameters.staticData.tileBorderSegments(), + programInstance.computeAllUniformValues( + DebugProgram::LayoutUniformValues{uniforms::matrix::Value(matrix), + uniforms::color::Value(Color::red())}, + paintAttributeData, + properties, + parameters.state.getZoom()), + programInstance.computeAllAttributeBindings( + *parameters.staticData.tileVertexBuffer, paintAttributeData, properties), + DebugProgram::TextureBindings{}, + "image"); } } |