Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Pass only visible render layers to source in renderer
Browse files Browse the repository at this point in the history
This simplifies the code and make it slightly more performant.

Also, this change enables initialization the `RenderTile.used`
field from inside the source (currently done in render layers).
  • Loading branch information
pozdnyakov committed Apr 9, 2019
1 parent f22c014 commit 8faf47a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/mbgl/renderer/renderer_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,17 +248,15 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
for (const auto& layerImpl : *layerImpls) {
RenderLayer* layer = getRenderLayer(layerImpl->id);
const auto* layerInfo = layerImpl->getTypeInfo();
bool layerNeedsRendering = layer->needsRendering(zoomHistory.lastZoom);

const bool layerNeedsRendering = layer->needsRendering(zoomHistory.lastZoom);
staticData->has3D = (staticData->has3D || layerInfo->pass3d == LayerTypeInfo::Pass3D::Required);

if (layerInfo->source != LayerTypeInfo::Source::NotRequired) {
if (layerImpl->source == sourceImpl->id) {
sourceNeedsRendering |= layerNeedsRendering;
sourceNeedsRelayout = (sourceNeedsRelayout || hasImageDiff || hasLayoutDifference(layerDiff, layerImpl->id));
filteredLayersForSource.push_back(layerImpl);

if (layerNeedsRendering) {
sourceNeedsRendering = true;
filteredLayersForSource.push_back(layerImpl);
renderItems.emplace_back(*layer, source);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/tile/geometry_tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ void GeometryTile::setLayers(const std::vector<Immutable<Layer::Impl>>& layers)
// Skip irrelevant layers.
assert(layer->getTypeInfo()->source != LayerTypeInfo::Source::NotRequired);
assert(layer->source == sourceID);
assert(layer->visibility != VisibilityType::None);
if (id.overscaledZ < std::floor(layer->minZoom) ||
id.overscaledZ >= std::ceil(layer->maxZoom) ||
layer->visibility == VisibilityType::None) {
id.overscaledZ >= std::ceil(layer->maxZoom)) {
continue;
}

Expand Down

0 comments on commit 8faf47a

Please sign in to comment.