From 536e577f549ec93cfb6918a580b944011b259c6e Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 3 Oct 2023 11:49:17 +0000 Subject: [PATCH] remove redundant static and move after free triggered --- src/mbgl/renderer/layers/render_fill_layer.cpp | 17 ++++++++--------- .../renderer/layers/render_heatmap_layer.cpp | 8 ++++---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index 02176fdb7..a062cb375 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -46,15 +46,14 @@ constexpr auto FillOutlineShaderName = "FillOutlineShader"; constexpr auto FillPatternShaderName = "FillPatternShader"; constexpr auto FillOutlinePatternShaderName = "FillOutlinePatternShader"; -static const StringIdentity idFillOutlineInterpolateUBOName = StringIndexer::get("FillOutlineInterpolateUBO"); -static const StringIdentity idFillPatternInterpolateUBOName = StringIndexer::get("FillPatternInterpolateUBO"); -static const StringIdentity idFillPatternTilePropsUBOName = StringIndexer::get("FillPatternTilePropsUBO"); -static const StringIdentity idFillOutlinePatternInterpolateUBOName = StringIndexer::get( - "FillOutlinePatternInterpolateUBO"); -static const StringIdentity idFillOutlinePatternTilePropsUBOName = StringIndexer::get("FillOutlinePatternTilePropsUBO"); +const StringIdentity idFillOutlineInterpolateUBOName = StringIndexer::get("FillOutlineInterpolateUBO"); +const StringIdentity idFillPatternInterpolateUBOName = StringIndexer::get("FillPatternInterpolateUBO"); +const StringIdentity idFillPatternTilePropsUBOName = StringIndexer::get("FillPatternTilePropsUBO"); +const StringIdentity idFillOutlinePatternInterpolateUBOName = StringIndexer::get("FillOutlinePatternInterpolateUBO"); +const StringIdentity idFillOutlinePatternTilePropsUBOName = StringIndexer::get("FillOutlinePatternTilePropsUBO"); -static const StringIdentity idPosAttribName = StringIndexer::get("a_pos"); -static const StringIdentity idIconTextureName = StringIndexer::get("u_image"); +const StringIdentity idPosAttribName = StringIndexer::get("a_pos"); +const StringIdentity idIconTextureName = StringIndexer::get("u_image"); #endif // MLN_DRAWABLE_RENDERER inline const FillLayer::Impl& impl_cast(const Immutable& impl) { @@ -704,6 +703,7 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, patternBuilder->setRenderPass(renderPass); if (outlinePatternBuilder) { patternBuilder->setVertexAttributes(vertexAttrs); + outlinePatternBuilder->setVertexAttributes(std::move(vertexAttrs)); } else { patternBuilder->setVertexAttributes(std::move(vertexAttrs)); } @@ -722,7 +722,6 @@ void RenderFillLayer::update(gfx::ShaderRegistry& shaders, if (outlinePatternBuilder && bucket.sharedLines->elements()) { outlinePatternBuilder->setShader(outlineShader); outlinePatternBuilder->setRenderPass(renderPass); - outlinePatternBuilder->setVertexAttributes(std::move(vertexAttrs)); outlinePatternBuilder->setRawVertices({}, vertexCount, gfx::AttributeDataType::Short2); outlinePatternBuilder->setSegments( gfx::Lines(2), bucket.sharedLines, bucket.lineSegments.data(), bucket.lineSegments.size()); diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index aade91552..6264c29f2 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -280,10 +280,10 @@ namespace { constexpr auto HeatmapShaderGroupName = "HeatmapShader"; constexpr auto HeatmapTextureShaderGroupName = "HeatmapTextureShader"; -static const StringIdentity idHeatmapInterpolateUBOName = StringIndexer::get("HeatmapInterpolateUBO"); -static const StringIdentity idVertexAttribName = StringIndexer::get("a_pos"); -static const StringIdentity idTexImageName = StringIndexer::get("u_image"); -static const StringIdentity idTexColorRampName = StringIndexer::get("u_color_ramp"); +const StringIdentity idHeatmapInterpolateUBOName = StringIndexer::get("HeatmapInterpolateUBO"); +const StringIdentity idVertexAttribName = StringIndexer::get("a_pos"); +const StringIdentity idTexImageName = StringIndexer::get("u_image"); +const StringIdentity idTexColorRampName = StringIndexer::get("u_color_ramp"); } // namespace