-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Separate annotation sprite atlas from the style, proposed fix for #1488 #3049
Conversation
Digging into this now @adam-mapbox, but some code review / understanding comments:
And I'd be curious if @jfirebaugh or @kkaefer have any thoughts here about adding functionality to the I'm still doing some investigations into thread safety. It seems like we might be able to indicate some |
Oh, I think I follow — the normal style sprite. And a single annotation sprite, which doesn't come into play if there are no annotations. In that case, do we / can we destroy it when all image annotations are removed? |
Why is |
AFAICT this looks good thread-wise. The edge cases I fear (but don't seem to have the head for checking for just yet) are:
BTW, in case it's not obvious, the fix works as intended 😄 |
Ah, so |
Also, yeah, totally weird failing test on Travis here (e.g. https://travis-ci.org/mapbox/mapbox-gl-native/jobs/91681030). It's expecting the custom sprite functionality to log 21 errors and none are. Any insight there @kkaefer since you wrote the test? |
The intent was that |
I'm at a loss about what to do about this failing test. I'm out of my depth here; the test is failing on linux only, and I don't understand the test or what it's supposed to do, and I don't know how to reproduce it. I could use some assistance. |
Agree, but the reason we're seeing it only on Linux is that's the only place these core tests are run. So at least we're consistent (i.e. not a flapping test). Going to play with this test locally a bit. |
Maybe |
How do I run the core tests locally? Can I? |
I think, as in Travis, it's just |
Figured out the format here @adam-mapbox:
http://stackoverflow.com/questions/7208070/googletest-how-to-skip-a-test was useful here. |
Clarified docs at b07d4c8. |
👍 Will add some line by line comments for small improvements, but overall I like this approach a lot. |
#include <mbgl/layer/symbol_layer.hpp> | ||
#include <mbgl/style/style.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid reordering the includes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You guys don't alphabetize includes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're typically roughly in order of "importance", as best I can read. So in this case, we've got our own class header, then the thing we produce, then the thing we use to produce that, then a specific class of several peers that we need access to. At least that's my logic flow in looking at the old version. Maybe we should settle on a stricter system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we don't really have a strict system, except that we try to group by path prefix.
The annotation |
Never mind, I figured it out :) |
Could we make |
We certainly could do that. Doesn't that just kind of push the problem around? Making |
I've encountered several issues in the course of working on annotations today (investigating #3037 and testing this PR):
|
The tiles always arrive first and from the tiles we see what sprites are needed. Meanwhile we draw whatever we have. When the sprites finally arrive, the |
@@ -48,6 +54,9 @@ class AnnotationManager : private util::noncopyable { | |||
ShapeAnnotationImpl::Map shapeAnnotations; | |||
std::vector<std::string> obsoleteShapeAnnotationLayers; | |||
std::set<AnnotationTileMonitor*> monitors; | |||
|
|||
SpriteStore spriteStore; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't be easier to have these objects living the MapContext
object? They would survive a style change anyway and would have a more clear scope. The crash I'm seeing on Linux is related to destruction order, not threading issues.
We are calling glObjectStore.performCleanup()
on MapContext::cleanup()
just before calling ~MapContext()
that will ultimately call the ~MapData()
-> ~AnnotationManager()
-> ~SpriteAtlas()
that tries to dispose the textures but they never get cleaned up.
This patch fixes the crash on your branch: c15e1e6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are specific to annotations, so I'd rather have them owned by AnnotationManager
.
Your analysis of the issue sounds correct; however I would rather fix it by using std::unique_ptr<AnnotationManager>
in MapData
and resetting that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your analysis of the issue sounds correct; however I would rather fix it by using std::unique_ptr in MapData and resetting that.
That also should work.
bc2c0d1
to
b8ad8c1
Compare
Sounds like from voice that @jfirebaugh is wrapping up test accuracy here, then we can crunch this a bit into a final proposed PR @adam-mapbox? |
I'm on it. |
👍 Cool just syncing up. |
b8ad8c1
to
2ff3a5e
Compare
This allows MapData members to hold GL resources which must be released on the MapContext thread -- necessary for the following commit.
2ff3a5e
to
622f669
Compare
🎉 |
@incanus Was this fix not included in iOS 3.0.1 (released after fix was committed) ? I'm using 3.0.1 and still seeing this. |
@cowgp That's correct. The 3.0.1 release branch was created before this fix was implemented, and it was deemed too risky to backport. It will be in the next iOS SDK release. |
@jfirebaugh - thanks. That obviously begs the question, what's an ETA on the next release? |
Added to the changelog in 0d3af14. @cowgp, the 3.1.0 release is coming soon. In the meantime, you can try out the fix in this prerelease (podspec for CocoaPods). |
Thanks @1ec5 - I built a custom version off the master branch last week and pointed to a custom podspec for that. I noticed the 3.1.0-pre.X podspecs have the deployment target bumped to 8.0. Do you know why? |
Starting in 3.1.0, the pod will download a dynamic framework; dynamic frameworks are only supported by iOS 8.0 and above. If you need iOS 7.x support, you’ll need to download the static framework manually from the releases page. |
@kkaefer @jfirebaugh @incanus
Comments about thread safety, etc. welcome.