Improve memory usage by using a single buffer for WebGL layers#16942
Merged
Conversation
This utility also now converts all flat style rules to shaders, to be processed by a single VectorStyleRenderer
|
📦 Preview the website for this branch here: https://deploy-preview-16942--ol-site.netlify.app/. |
The VectorStyleRenderer class now handles multiple render passes while still using a single buffer; attributes of all the styles are assembled into a single buffer. This also means that there is no need to filter the geometry batches anymore before rendering.
663e7c6 to
6897fdb
Compare
ahocevar
approved these changes
Jun 30, 2025
Contributor
Author
|
Thank you @ahocevar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR makes it so that a single WebGL layer will generate a single buffer (for each geometry type) combining the attributes used in all the style rules, instead of one buffer per style rule).
This single buffer will be a bit bigger compared to the separate ones before, but the overall memory usage should be drastically reduced. The time spent generating those buffers as well as the render instructions is also reduced, thus improving performance overall.
Inspired by @nssang00 propositions in #16898
No noticeable effect on the benchmark app unfortunately... But this will give way to instanced rendering which should improve things further.
Note: this PR also fixes the fact that the
cacheSizeoption of theWebGLVectorTileLayerclass wasn't properly taken into account.