Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] Release quad data after vertex buffers are created #15189

Merged
merged 3 commits into from
Jul 23, 2019

Conversation

alexshalamov
Copy link
Contributor

@alexshalamov alexshalamov commented Jul 21, 2019

When long line segments are rendered, engine could create thousands of symbol instances for the same label that is repeated along the line for different anchors (e.g., road labels / shields).

This PR introduces code that shares symbol quads between symbol instances and releases aux data structures once vertex buffers are created.

Before:

Screen Shot 2019-07-21 at 12 21 25

After:

Screen Shot 2019-07-21 at 12 23 08

Partially fixes issue #15022

@alexshalamov alexshalamov force-pushed the alexshalamov_release_unused_resources branch 3 times, most recently from 3abfc07 to cdd874b Compare July 22, 2019 08:34
@alexshalamov alexshalamov marked this pull request as ready for review July 22, 2019 09:06
src/mbgl/layout/symbol_instance.cpp Outdated Show resolved Hide resolved
src/mbgl/layout/symbol_layout.cpp Outdated Show resolved Hide resolved
@alexshalamov alexshalamov force-pushed the alexshalamov_release_unused_resources branch from cdd874b to 32a031c Compare July 22, 2019 17:02
@alexshalamov
Copy link
Contributor Author

@astojilj could you ptal?

Copy link
Contributor

@astojilj astojilj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions to help me better understand the code. Not immediately clear from where the memory saving comes. Thanks

src/mbgl/layout/symbol_instance.cpp Show resolved Hide resolved
src/mbgl/layout/symbol_instance.hpp Show resolved Hide resolved
@friedbunny friedbunny added Core The cross-platform C++ core, aka mbgl performance Speed, stability, CPU usage, memory usage, or power usage labels Jul 22, 2019
@friedbunny friedbunny added this to the release-queso milestone Jul 22, 2019
Copy link
Contributor

@astojilj astojilj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for offline clarification.
Few notes from the discussion:

  • It is not possible to release shared data aggregated std::vectors memory with higher granularity that now (master release switch).
  • Allocations and release will all later happen outside the render thread.
  • Likely to be changed after instanced draw implementation.

LGTM. Thanks.

@alexshalamov alexshalamov force-pushed the alexshalamov_release_unused_resources branch from 32a031c to 3c36ab6 Compare July 23, 2019 12:02
@alexshalamov alexshalamov merged commit d7dd352 into master Jul 23, 2019
@friedbunny friedbunny deleted the alexshalamov_release_unused_resources branch July 23, 2019 16:25
@alexshalamov alexshalamov self-assigned this Jul 29, 2019
@chloekraw chloekraw added the needs changelog Indicates PR needs a changelog entry prior to merging. label Aug 1, 2019
@chloekraw chloekraw removed the needs changelog Indicates PR needs a changelog entry prior to merging. label Aug 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core The cross-platform C++ core, aka mbgl performance Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants