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

Feature state updates #15872

Closed
wants to merge 6 commits into from
Closed

Feature state updates #15872

wants to merge 6 commits into from

Conversation

jmalanen
Copy link
Contributor

@jmalanen jmalanen commented Oct 30, 2019

[glfw] Update feature state only when the layer is visible
-- small optimization to the glfw test app

[core] Add feature state support to composite crossfade binder
-- This adds feature state support for eg. fill-pattern
-- Related gl-js PR: mapbox/mapbox-gl-js#8927

[core] Add getMissingImages API to GeometryTile
[core] Pass GeometryTile to paint property binder
-- These two are requirements for the above composite crossfade binder patch

[core] Upload buckets only when there are feature state changes
-- Optimization

Fixes: #15895

@jmalanen jmalanen force-pushed the jmalanen-feature branch 5 times, most recently from 5fe6a4a to d1ea075 Compare October 31, 2019 11:41
@jmalanen jmalanen marked this pull request as ready for review October 31, 2019 13:05
@jmalanen jmalanen requested a review from 1ec5 as a code owner October 31, 2019 13:05
@jmalanen jmalanen self-assigned this Oct 31, 2019
@@ -159,7 +159,7 @@ global.objCTestValue = function (property, layerType, arraysAsStructs, indent) {
`@"'${_.startCase(propertyName)}'"` :
`@"${_.startCase(propertyName)}"`;
case 'string':
case 'image': // TODO: replace once we implement image expressions
case 'resolvedImage': // TODO: replace once we implement image expressions
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll want to make these changes in the https://github.com/mapbox/mapbox-gl-native-ios repo.

Similarly the Android ones in https://github.com/mapbox/mapbox-gl-native-android. Correct @tobrun?

Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +258 to +269
if (!missingImagesRequested) {
worker.self().invoke(&GeometryTileWorker::onImagesAvailable,
std::move(images),
std::move(patterns),
std::move(versionMap),
imageCorrelationID);
} else {
layoutResult->iconAtlas = makeImageAtlas(images, patterns, versionMap);
missingImagesRequested = false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs a unit test, if for some reason missingImagesRequested is stale and set to true, we will never trigger re-layout when image manager provides requested images.

using namespace mbgl;
FeatureState newState;

if (result.size() > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: !result.empty()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
}
} else {
if (view->featureID) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: else if

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -50,7 +52,9 @@ class Bucket {
bool needsUpload() const {
return hasData() && !uploaded;
}


virtual bool uploadPending() const { return needsUpload() || stateChanged; }
Copy link
Contributor

Choose a reason for hiding this comment

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

why couldn't we just check stateChanged insideneedsUpload()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
stateChanged = updated;
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this snippet being repeated several times, can it be shared?

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe put to a basic class?

@@ -109,9 +110,19 @@ class PaintPropertyBinder {
const ImagePositions&, const optional<PatternDependency>&,
const style::expression::Value&) = 0;

virtual void updateVertexVectors(const FeatureStates&, const GeometryTileLayer&, const ImagePositions&) {}
virtual bool updateVertexVectors(const FeatureStates&,
Copy link
Contributor

Choose a reason for hiding this comment

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

pls add a comment documenting the returned value

virtual bool updateVertexVectors(const FeatureStates&,
const GeometryTileLayer&,
const ImagePositions&,
GeometryTile&) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not pass tile here, it's better to keep it decoupled from rendering

@chloekraw
Copy link
Contributor

@jmalanen does this need a changelog, or is it all internal code so far that doesn't impact developers until we introduce new APIs?

@jmalanen
Copy link
Contributor Author

@jmalanen does this need a changelog, or is it all internal code so far that doesn't impact developers until we introduce new APIs?

This is all internal code for now that doesn't impact developers.

@chapmanjacobd
Copy link

is there anything that an outside contributor can do to help push this along? I would like to use this feature in mapbox/mapbox-gl-js#7207

@jplante
Copy link

jplante commented Mar 13, 2020

Our team is very eager for this release as well.

@jmurphy-asurity
Copy link

I'm stuck on an old fork of GL JS waiting for this, I'd love to see this get moving again.

@derrickrung
Copy link

derrickrung commented Apr 24, 2020

Thanks for all the great work. Super excited about this PR, our team has been looking forward to this for a while. Anything we can help do to get this moved along?

@jmalanen
Copy link
Contributor Author

@chapmanjacobd @jmurphy-asurity @jplante @derrickrung

Which one of you are interested in the GL native version?

This is currently on hold, but if you are interested in GL JS please add your request to mapbox/mapbox-gl-js#7207

@jmurphy-asurity
Copy link

Thanks for the update @jmalanen. I'm interested in both, but GL JS is more important to me. Why is this on hold? It seemed like it was nearly ready.

@jmalanen jmalanen closed this Jul 7, 2022
@jmalanen jmalanen deleted the jmalanen-feature branch July 7, 2022 13:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix feature-state dependent styles for *-pattern properties
10 participants