[core] don't generate clip IDs for buckets/layers that don't need to be clipped
This commit is contained in:
@@ -17,7 +17,7 @@ void ClipIDGenerator::update(std::vector<std::reference_wrapper<Renderable>> ren
|
|||||||
const auto end = renderables.end();
|
const auto end = renderables.end();
|
||||||
for (auto it = renderables.begin(); it != end; it++) {
|
for (auto it = renderables.begin(); it != end; it++) {
|
||||||
auto& renderable = it->get();
|
auto& renderable = it->get();
|
||||||
if (!renderable.used) {
|
if (!renderable.used || !renderable.needsClipping) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public:
|
|||||||
mat4 matrix;
|
mat4 matrix;
|
||||||
mat4 nearClippedMatrix;
|
mat4 nearClippedMatrix;
|
||||||
bool used = false;
|
bool used = false;
|
||||||
|
bool needsClipping = false;
|
||||||
|
|
||||||
mat4 translatedMatrix(const std::array<float, 2>& translate,
|
mat4 translatedMatrix(const std::array<float, 2>& translate,
|
||||||
style::TranslateAnchorType anchor,
|
style::TranslateAnchorType anchor,
|
||||||
|
|||||||
@@ -370,6 +370,13 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
|
|||||||
if (bucket) {
|
if (bucket) {
|
||||||
sortedTilesForInsertion.emplace_back(tile);
|
sortedTilesForInsertion.emplace_back(tile);
|
||||||
tile.used = true;
|
tile.used = true;
|
||||||
|
|
||||||
|
// We only need clipping when we're _not_ drawing a symbol layer. The only exception
|
||||||
|
// for symbol layers is when we're rendering still images. See render_symbol_layer.cpp
|
||||||
|
// for the exception we make there.
|
||||||
|
if (!symbolLayer || parameters.mapMode == MapMode::Still) {
|
||||||
|
tile.needsClipping = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
layer->setRenderTiles(std::move(sortedTilesForInsertion));
|
layer->setRenderTiles(std::move(sortedTilesForInsertion));
|
||||||
|
|||||||
@@ -8,13 +8,16 @@ struct Renderable {
|
|||||||
UnwrappedTileID id;
|
UnwrappedTileID id;
|
||||||
ClipID clip;
|
ClipID clip;
|
||||||
bool used;
|
bool used;
|
||||||
|
bool needsClipping;
|
||||||
|
|
||||||
Renderable(UnwrappedTileID id_,
|
Renderable(UnwrappedTileID id_,
|
||||||
ClipID clip_,
|
ClipID clip_,
|
||||||
bool used_ = true)
|
bool used_ = true,
|
||||||
|
bool needsClipping_ = true)
|
||||||
: id(std::move(id_)),
|
: id(std::move(id_)),
|
||||||
clip(std::move(clip_)),
|
clip(std::move(clip_)),
|
||||||
used(used_) {}
|
used(used_),
|
||||||
|
needsClipping(needsClipping_) {}
|
||||||
|
|
||||||
bool operator==(const Renderable& rhs) const {
|
bool operator==(const Renderable& rhs) const {
|
||||||
return id == rhs.id && clip == rhs.clip;
|
return id == rhs.id && clip == rhs.clip;
|
||||||
|
|||||||
Reference in New Issue
Block a user