diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-04-02 14:11:37 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2019-05-15 11:57:43 -0700 |
commit | bf0998697e0893d8a56421a139c7fc4855e89fa5 (patch) | |
tree | 1d3bef4bdad2f2da10275b214662c8925829024a /src/mbgl/renderer | |
parent | 03e434e901cebf3b78bcba9ef9c7fe941012735e (diff) | |
download | qtlocation-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.cpp | 6 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/symbol_bucket.cpp | 13 |
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; |