only update the render order array when there are changes to tiles

This commit is contained in:
Konstantin Käfer
2015-08-20 15:34:32 -04:00
parent 038b65eded
commit fd98607c5f
4 changed files with 27 additions and 21 deletions

View File

@@ -181,9 +181,6 @@ void Painter::render(const Style& style, TransformState state_, const FrameData&
resize();
changeMatrix();
// Figure out what buckets we have to draw and what order we have to draw them in.
const auto order = determineRenderOrder(style);
// - UPLOAD PASS -------------------------------------------------------------------------------
// Uploads all required buffers and images before we do any actual rendering.
{
@@ -202,7 +199,6 @@ void Painter::render(const Style& style, TransformState state_, const FrameData&
}
}
// - CLIPPING MASKS ----------------------------------------------------------------------------
// Draws the clipping masks to the stencil buffer.
{
@@ -273,6 +269,8 @@ void Painter::renderPass(RenderPass pass_,
const float strataThickness) {
pass = pass_;
const double zoom = state.getZoom();
MBGL_DEBUG_GROUP(pass == RenderPass::Opaque ? "opaque" : "translucent");
if (debug::renderTree) {
@@ -285,6 +283,13 @@ void Painter::renderPass(RenderPass pass_,
for (; it != end; ++it, i += increment) {
const auto& item = *it;
if (item.bucket && item.tile) {
// Skip this layer if it's outside the range of min/maxzoom.
// This may occur when there /is/ a bucket created for this layer, but the min/max-zoom
// is set to a fractional value, or value that is larger than the source maxzoom.
if (item.layer.bucket->min_zoom > zoom ||
item.layer.bucket->max_zoom <= zoom) {
continue;
}
if (item.layer.hasRenderPass(pass)) {
MBGL_DEBUG_GROUP(item.layer.id + " - " + std::string(item.tile->id));
setStrata(i * strataThickness);
@@ -303,8 +308,8 @@ void Painter::renderPass(RenderPass pass_,
}
}
std::vector<RenderItem> Painter::determineRenderOrder(const Style& style) {
std::vector<RenderItem> order;
void Painter::updateRenderOrder(const Style& style) {
order.clear();
for (const auto& layerPtr : style.layers) {
const auto& layer = *layerPtr;
@@ -341,15 +346,6 @@ std::vector<RenderItem> Painter::determineRenderOrder(const Style& style) {
continue;
}
// Skip this layer if it's outside the range of min/maxzoom.
// This may occur when there /is/ a bucket created for this layer, but the min/max-zoom
// is set to a fractional value, or value that is larger than the source maxzoom.
const double zoom = state.getZoom();
if (layer.bucket->min_zoom > zoom ||
layer.bucket->max_zoom <= zoom) {
continue;
}
const auto& tiles = source->getTiles();
for (auto tile : tiles) {
assert(tile);
@@ -363,8 +359,6 @@ std::vector<RenderItem> Painter::determineRenderOrder(const Style& style) {
}
}
}
return order;
}
void Painter::renderBackground(const StyleLayer &layer_desc) {