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

Port global symbol query from GL JS #11742

Merged
merged 3 commits into from
Apr 25, 2018
Merged

Port global symbol query from GL JS #11742

merged 3 commits into from
Apr 25, 2018

Conversation

ChrisLoer
Copy link
Contributor

@ChrisLoer ChrisLoer commented Apr 19, 2018

Fix for #11679.

This is a pretty direct port of the GL JS functionality. Things I'm a little uncomfortable with:

  • There's a lot of copying around of IndexedSubfeatures we're doing, especially since they contain (hopefully short/fixed length) strings. I don't have a reason to think this is a performance hotspot, but it looks awkward.
  • The widely distributed shared_ptr-style ownership feels a little hard-to-audit (although it's the same as the javascript behavior, C++ just calls more attention to it).

The fix is not as critical for native because native never had an "incremental placement", but this still fixes (1) querying near tile boundaries, and (2) result sort order for symbol buckets that have been re-sorted after generation. It's also nice that it gets rid of the commitFeatureIndexes pathway.

/cc @ansis @jfirebaugh

@ChrisLoer ChrisLoer added GL JS parity For feature parity with Mapbox GL JS ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold labels Apr 19, 2018
@ChrisLoer ChrisLoer requested review from jfirebaugh and ansis April 19, 2018 22:15
Copy link
Contributor

@ansis ansis left a comment

Choose a reason for hiding this comment

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

This looks good to me from the symbol side of things but it might be good to get some extra eyes on the c++ side?

@ChrisLoer ChrisLoer changed the base branch from release-boba to master April 23, 2018 23:10
@ChrisLoer ChrisLoer removed the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Apr 23, 2018
@ChrisLoer ChrisLoer changed the title [do not merge] Port global symbol query from GL JS Port global symbol query from GL JS Apr 23, 2018
@ChrisLoer ChrisLoer added bug Core The cross-platform C++ core, aka mbgl refactor labels Apr 23, 2018
 - Symbol querying is now global instead of per-tile
 - Symbols that bleed over tile boundaries no longer missed in queries
 - Symbol results now sorted based on rendering order (ie overlapping symbols change their sort order when a bearing change causes their render order to change)
 - Placement::retainedQueryData now responsible for maintaining symbol querying data for buckets that may no longer be in the TilePyramid.
 - Pulls over an update to line.vertex.glsl (looks like a no-op?)
 - Add test ignores for collator, is-supported-script, line-gradient
 - Exclude collator, is-supported-script, line-gradient from code generation.
continue;
}

auto bucket = renderTile.tile.getBucket(*symbolLayer.baseImpl);
GeometryTile& geometryTile = static_cast<GeometryTile&>(renderTile.tile);
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of doubling up on the dyanmic_cast and static_cast, how about using an assert(dynamic_cast<GeometryTile*>(&renderTile.tile). Aren't symbol layers expected to always have a geometry tile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that sounds reasonable -- we're already doing the same thing in RenderSymbolLayer.

@@ -305,6 +314,9 @@ void Placement::updateBucketOpacities(SymbolBucket& bucket, std::set<uint32_t>&

bucket.updateOpacity();
bucket.sortFeatures(state.getAngle());
if (retainedQueryData.find(bucket.bucketInstanceId) != retainedQueryData.end()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate calls to find. Pull out of the if condition.

- assert symbol layer tiles must be geometry tiles, instead of dynamically checking
- re-use retainedBucketQuery iterator instead of calling find twice.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Core The cross-platform C++ core, aka mbgl GL JS parity For feature parity with Mapbox GL JS refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants