Port high resolution local SDFs #10298
Merged
+273
−67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Launch Checklist
This PR brings gl-js to parity with gl-native by porting the 2x resolution local glyph generation. It includes:
TextMetrics
and support for local generation of non-ideographic glyphs usinglocalFontFamily
map option. (Previously in PR Add 'localFontFamily' option to support rendering of all glyphs. #10267: I've rolled it into this PR because both PRs depend on the same TinySDF changes and I've been testing them together).The visual improvement is noticeable on high DPI screens, and can also be seen easily in large labels:
Before


After


For default settings, these changes have negligible performance impact for maps without heavy CJK-use. For CJK maps, the main impact is at load time (generating SDFs for the first time), although there is a small ongoing hit from loading larger glyph atlases (SDF generation is also an ongoing cost once the map is loaded, but the rate of new glyph generation drops off pretty quickly once a set of common characters are loaded). One option we have for ameliorating the load time performance hit is to do SDF generation on the workers. However, if we can get away with it, I'd like to avoid that complexity. For performance testing, I used benchmap-js with a Japanese-language style that rendered three cities at z8, z12, and z16. The main results were:
The 16% full-load slow down is similar to the performance hit we accepted on the "Tokyo All Local Glyphs" perf benchmark on the native side.
@mapbox/map-design-team
@mapbox/static-apis
if this PR includes style spec API or visual changes@mapbox/gl-native
if this PR includes shader changes or needs a native portmapbox-gl-js
changelog:cc @mourner @zmiao @asheemmamoowala @alexshalamov @YoshiYazawa @tsuz @ansis