-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add style#setSprite method #3662
Conversation
👋 @lucaswoj @jfirebaugh just flagging that this is a proposed amendment to #3621, which we talked about merging tomorrow. |
2f5f492
to
92956de
Compare
22d87a8
to
97ae0b6
Compare
I'm seeing some visual artifacting when there are icons on screen while the transition occurs. I suspect there's a race condition where, prior to the tiles finishing their reload, buffers that contain texture coordinates relative to the prior sprite are drawn with the newer sprite. |
@jfirebaugh what do you think is the ideal behavior here? Should we essentially track/detect when a tile's got stale spritesheet data, and bail out of rendering the offending layer? Or do we want to try something more ambitious, like cross-fading between the old and new sprites? |
It's a hard problem, and I don't see any easy solution. The sprite texture is essentially a shared resource that safe to delete only when there are no buffers containing texture coordinates that refer to it. It's similar to why updating a single image in the sprite is hard. |
I think the solution here has to be something like: treat the texture itself as a persistent resource -- never delete it. Instead, reference count individual images within it, like we do for glyphs. We'll need to add a generation identifier to the user-specified image identifier, to allow |
smart-set-style
(#3621), notmaster
Closes #2058
This turned out to be simpler than I thought (unless I'm missing something). Render tests, including the new set-style runtime styling tests, still pass, and the light/dark setStyle debug page works, now with changing
sprite
URIs.