Repository navigation
Increase the maximum size of glyph atlas - #2930
Conversation
|
Yay! Been waiting a long time for this..
|
| map.on('load', function () { | ||
| map.addSource("points", { | ||
| "type": "geojson", | ||
| "data": 'https://raw.githubusercontent.com/mapbox/mapbox-gl-test-suite/cjk-overflow/data/cjkPts.geojson' |
There was a problem hiding this comment.
You can change this line to mapbox-gl-test-suite/cjk-overflow/data/cjkPts.geojson
Fortunately, shaders are not coupled to the bit-width of these attributes. https://github.com/mapbox/mapbox-gl-shaders/blob/master/src/icon.vertex.glsl#L11-L12 |
These benchmarks are machine-specific and therefore relative numbers. Can you re-run these benchmarks against both this branch and |
Isn't the glyph shader But either way, that is helpful that the bit width doesn't need to change in the shader code.
If performance is a concern, could we dynamically adjust |
This is a great idea and is theoretically possible. Implementing it will require some bigger architectural changes. Let's keep this idea in our back pocket. |
|
Thanks for all the detailed feedback! Updated this PR per comments. Bench results on master versus branch below. Please let me know if I've missed / misunderstood something : ) masterbuffer: 795 ms fps: 60 frames per second frame-duration: avg: 6.7 ms per frame. 0% of frames took longer than 16ms. this prbuffer: 833 ms fps: 60 frames per second frame-duration: avg: 6.7 ms per frame. 0% of frames took longer than 16ms. |
|
This is looking great @xrwang! A 5% slowdown in buffer creation time (795 ms -> 833 ms) is a good starting point. Do you think there's anything we can do to make the slowdown even smaller? Did you verify that the slowdown is related to the increase in |
|
@lucaswoj, yup, I can definitely confirm that the slow down is related to the increase in benching sequence, results in order*
|
|
This looks great! Thank you for doing these benchmarks @xrwang.
It is possible and looks to be the case that the glyph atlas size has a large effect on performance too. If a width of 2048 is enough for real world usage with CJK fonts then I'm happy with this result and almost ready to ship this PR. Next StepsSee below 👇 |
| @@ -61,11 +61,11 @@ var layoutVertexArrayType = new Bucket.VertexArrayType([{ | |||
| type: 'Int16' | |||
| }, { | |||
| name: 'a_data1', | |||
There was a problem hiding this comment.
What do you think about renaming this to something more self-documenting like a_texture_pos?
There was a problem hiding this comment.
👍 sounds good, it'll be clearer that way.
|
cool, updated per comments. The name change for a_texture_pos is over here: mapbox/mapbox-gl-shaders#22 Tests over on mapbox/mapbox-gl-test-suite#131 should be ready. Benched with the resizing by 4 (instead of 2) and performance improved a lot! master this branch master this-branch |
|
Created mapbox/mapbox-gl-native#5873 to track these changes in GL native 👍 |
8ceb74d to
0e7cdbc
Compare
Next Steps
Related PRs |
|
Pushing squashed & based version. Previous HEAD was db7c0d8 |
Branch Benchmarksbuffer: 960 ms
|
| this.stacks[fontstack] = {}; | ||
| } | ||
| if (this.atlases[fontstack] === undefined) { | ||
| this.atlases[fontstack] = new GlyphAtlas(128, 128); |
There was a problem hiding this comment.
please leave this as 128,128.. most latin alphabets fit in this
There was a problem hiding this comment.
@bhousel It's still 128! I moved this constant inside GlyphAtlas because there are some tricky dependencies between the default size, growth factor, and max size. Having them all in one place makes that clearer.
There was a problem hiding this comment.
oh sorry!! you're right! :)
Enlarging the glyph sheet allows CJK characters to render and not overflow. Works with mapbox/mapbox-gl-test-suite#131 tests.
Performance of this PR on bench:
Buffer, 803 ms
FPS, 60 frames per second
cc @amyleew