summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-04-02 14:11:37 +0200
committerKonstantin Käfer <mail@kkaefer.com>2019-05-15 11:57:43 -0700
commitbf0998697e0893d8a56421a139c7fc4855e89fa5 (patch)
tree1d3bef4bdad2f2da10275b214662c8925829024a /src/mbgl/renderer
parent03e434e901cebf3b78bcba9ef9c7fe941012735e (diff)
downloadqtlocation-mapboxgl-bf0998697e0893d8a56421a139c7fc4855e89fa5.tar.gz
[core] don't upload empty buffers
Diffstat (limited to 'src/mbgl/renderer')
-rw-r--r--src/mbgl/renderer/buckets/debug_bucket.cpp6
-rw-r--r--src/mbgl/renderer/buckets/symbol_bucket.cpp13
2 files changed, 10 insertions, 9 deletions
diff --git a/src/mbgl/renderer/buckets/debug_bucket.cpp b/src/mbgl/renderer/buckets/debug_bucket.cpp
index 7b2f5c05ed..dac7622996 100644
--- a/src/mbgl/renderer/buckets/debug_bucket.cpp
+++ b/src/mbgl/renderer/buckets/debug_bucket.cpp
@@ -78,8 +78,10 @@ DebugBucket::DebugBucket(const OverscaledTileID& id,
segments.emplace_back(0, 0, vertices.elements(), indices.elements());
- vertexBuffer = context.createVertexBuffer(std::move(vertices));
- indexBuffer = context.createIndexBuffer(std::move(indices));
+ if (!vertices.empty()) {
+ vertexBuffer = context.createVertexBuffer(std::move(vertices));
+ indexBuffer = context.createIndexBuffer(std::move(indices));
+ }
}
} // namespace mbgl
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp
index 243cd4ebce..fb5a38f913 100644
--- a/src/mbgl/renderer/buckets/symbol_bucket.cpp
+++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp
@@ -48,6 +48,9 @@ void SymbolBucket::upload(gfx::Context& context) {
if (!staticUploaded) {
text.indexBuffer = context.createIndexBuffer(std::move(text.triangles), sortFeaturesByY ? gfx::BufferUsageType::StreamDraw : gfx::BufferUsageType::StaticDraw);
text.vertexBuffer = context.createVertexBuffer(std::move(text.vertices));
+ for (auto& pair : paintProperties) {
+ pair.second.textBinders.upload(context);
+ }
} else if (!sortUploaded) {
context.updateIndexBuffer(*text.indexBuffer, std::move(text.triangles));
}
@@ -68,6 +71,9 @@ void SymbolBucket::upload(gfx::Context& context) {
if (!staticUploaded) {
icon.indexBuffer = context.createIndexBuffer(std::move(icon.triangles), sortFeaturesByY ? gfx::BufferUsageType::StreamDraw : gfx::BufferUsageType::StaticDraw);
icon.vertexBuffer = context.createVertexBuffer(std::move(icon.vertices));
+ for (auto& pair : paintProperties) {
+ pair.second.iconBinders.upload(context);
+ }
} else if (!sortUploaded) {
context.updateIndexBuffer(*icon.indexBuffer, std::move(icon.triangles));
}
@@ -111,13 +117,6 @@ void SymbolBucket::upload(gfx::Context& context) {
}
}
- if (!staticUploaded) {
- for (auto& pair : paintProperties) {
- pair.second.iconBinders.upload(context);
- pair.second.textBinders.upload(context);
- }
- }
-
uploaded = true;
staticUploaded = true;
placementChangesUploaded = true;