-
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
Enable property functions for "text-size" and "icon-size" #4228
Comments
Great! 🎉 |
I was a bit concerned, seeing this line, that property functions for text and icon size would require introducing a new vertex attribute -- which, on the -native side, would take us back over the low-end-device limit of 8. Some notes from a deep dive trying to understand what's going on with
See also cac61d0 (h/t @jfirebaugh for finding this) Based on the fact that minzoom and maxzoom already exist as attributes (via |
Alright - looking into things a bit more, I think the main sticking point here is that we need to put more data into the layout attributes--namely:
Right now, the symbol layout attributes look like: attribute vec4 a_pos_offset;
attribute vec2 a_texture_pos; // backed by uint16
attribute vec4 a_data; // backed by uint8 So, we do have enough bits in here to pack in the size data we need, but to get decent precision I think we're gonna have to get a little hacky. Something like:
cc @jfirebaugh @lucaswoj @mollymerp -- anyone see a less ugly way forward here? |
Hmm, actually, there's a problem I didn't account for in my previous comment: the text and icons in a single symbol layer are rendered in different draw calls, but they share the same layout attributes. To use the strategy described above, we'd need to include both 🤔 |
They share the same attribute layout, but don't share attribute buffers. The layout can contain a |
👍 on the packing strategy. Looks like we have just enough bits for everything. |
Oh! You're totally right--I had psyched myself out. Yay 🎉 |
An issue I'm now realizing as I work on implementing this: both in native and JS, all the machinery around how we bind possibly data-driven properties to attributes(/uniforms) is set up to handle paint properties. Specifically, this machinery makes sure that we only use as big a buffer as necessary, depending on whether a property value is constant, or a {source,camera,composite} function. Some options:
|
Up until now, we haven't needed any special "machinery" to handle data-driven layout properties. Unlike paint properties, layout properties are usually already specified as per-feature attributes. Take a look at this PR which adds support for a data-driven layout property, If you do need to build some new "machinery" you may find use from an earlier implementation of |
No description provided.
The text was updated successfully, but these errors were encountered: