summaryrefslogtreecommitdiff
path: root/test/geometry
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-10-25 11:57:09 +0200
committerKonstantin Käfer <mail@kkaefer.com>2019-10-29 11:27:24 +0100
commit84f2ff1084ccaec68c7a26243367ae657f6ebe60 (patch)
tree9fad662188267e9a91d78b78cac150223076dae4 /test/geometry
parent360b8b42471d7196511ab11edb4f9f277329af13 (diff)
downloadqtlocation-mapboxgl-84f2ff1084ccaec68c7a26243367ae657f6ebe60.tar.gz
[core] use individual textures for line dash patternsupstream/zmiao-test
This moves the LineAtlas from a shared texture that contained SDF dash patterns to use individual textures. Previously, the texture space was limited to a texture of 512 pixels height. Dash patterns were never removed (and are still never removed as of this patch), which means that this texture could fill up for styles that use a lot of different dash patterns. In particular, dash patterns for lines with a round line cap take up 15 pixels of texture height, limiting the amount of unique dash patterns to 34. While this was probably enough for rendering a single style, we quickly exhausted this number when reusing the Map object to render different styles. Instead of a global shared texture, we're now creating individual textures for every dash pattern. These textures are still cached so that we don't need to re-upload the texture on every frame.
Diffstat (limited to 'test/geometry')
-rw-r--r--test/geometry/line_atlas.test.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/geometry/line_atlas.test.cpp b/test/geometry/line_atlas.test.cpp
index 960e4ad7ad..1d817220e1 100644
--- a/test/geometry/line_atlas.test.cpp
+++ b/test/geometry/line_atlas.test.cpp
@@ -13,7 +13,7 @@ TEST(LineAtlas, Random) {
std::normal_distribution<float> lengthDistribution(3, 5);
for (size_t it = 0; it < 100; it++) {
- LineAtlas atlas{ Size{ 128, 1024 } };
+ LineAtlas atlas;
std::vector<float> dasharray;
dasharray.reserve(8);
for (size_t j = 0; j < 100; j++) {
@@ -25,7 +25,7 @@ TEST(LineAtlas, Random) {
const LinePatternCap patternCap =
capStyleDistribution(generator) > 0 ? LinePatternCap::Round : LinePatternCap::Square;
- atlas.addDash(dasharray, patternCap);
+ atlas.getDashPatternTexture(dasharray, dasharray, patternCap);
}
}
}