Skip to content

Commit

Permalink
Symbol Tweaker: Redundant update inside inner loop (#1891)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilsnd authored Nov 27, 2023
1 parent 04d5695 commit 634ce80
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/mbgl/renderer/layers/symbol_layer_tweaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ void SymbolLayerTweaker::execute(LayerGroupBase& layerGroup, const PaintParamete
/*.pad1=*/0,
/*.pad2=*/{0, 0}};

if (!dynamicBuffer) {
dynamicBuffer = parameters.context.createUniformBuffer(&dynamicUBO, sizeof(dynamicUBO));
} else {
dynamicBuffer->update(&dynamicUBO, sizeof(dynamicUBO));
}

visitLayerGroupDrawables(layerGroup, [&](gfx::Drawable& drawable) {
if (!drawable.getTileID() || !drawable.getData()) {
return;
Expand All @@ -124,12 +130,6 @@ void SymbolLayerTweaker::execute(LayerGroupBase& layerGroup, const PaintParamete
iconPropertiesUpdated = false;
}

if (!dynamicBuffer) {
dynamicBuffer = parameters.context.createUniformBuffer(&dynamicUBO, sizeof(dynamicUBO));
} else {
dynamicBuffer->update(&dynamicUBO, sizeof(dynamicUBO));
}

// from RenderTile::translatedMatrix
const auto translate = isText ? evaluated.get<style::TextTranslate>() : evaluated.get<style::IconTranslate>();
const auto anchor = isText ? evaluated.get<style::TextTranslateAnchor>()
Expand Down

0 comments on commit 634ce80

Please sign in to comment.