You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Reduce the number of vertex attributes used for data-driven styling. #8183
Using #8177, it looks like his device has GL_MAX_VERTEX_ATTRIBS = 8. Sounds like this is a common enough device that we need to reduce the number of attributes we're binding for each program.
Couple ways to do this that @jfirebaugh and I discussed for a different issue (which was solved another way):
we can pack the base attributes (a_pos, a_offset, a_texture_pos, a_data) more
make the min/max for float attributes into vectors
Based on some quick logging during attribute binding, it looks like the largest number of attributes we're currently using is in the circle program, at 14. Unfortunately, only 5 of the min/max pairs in this program are floats, so even if we packed them into vectors, we'd still be left with 9 > 8 attributes.
Do you actually have to declare API version 18 minimum to be able to create an ES 3.0 context? Or is that just the minimum version where support is guaranteed?
Also, I would assume that glGetString(GL_VERSION) returns you the version that the current context was created with, not necessarily the maximum supported version.
Do you actually have to declare API version 18 minimum to be able to create an ES 3.0 context? Or is that just the minimum version where support is guaranteed?
Also, I would assume that glGetString(GL_VERSION) returns you the version that the current context was created with, not necessarily the maximum supported version.
These docs, imply that it would show the highest supported version, even when the current context is created with a lower version.
I don't know if this applies to the GL stack but, in general on Android, you can keep providing support for older API levels while using features only available at a higher API number. You can check for this at runtime. For example:
private void initFeature() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES. ICE_CREAM_SANDWICH) {
// Do something only available on ICE_CREAM_SANDWICH and higher.
}
}
@zugaldia my assumption was that the devices that are currently only allowing 8 attributes under ES 2.0 (and thus having this problem) would be highly correlated with the ones that have older API levels. If that's true, then unfortunately this wouldn't get us out of the bind we're in.
@jfirebaugh even without integer attributes, could we encode each color as a pair of (highp) floats? If so, then a min/max pair of colors could be a highp vec4, right? That would actually get us down to exactly 8 in the circle program. That's right at the boundary, which gives us no wiggle room, but the upside is that it's a (relatively) low-burden change...
@jfirebaugh I'm not sure. The remaining paint properties after 7939 are just -translate and -translate-anchor, but we don't have a definite plan for those. One of the proposals in that ticket is to treat these like layout properties, but I don't yet understand what that would entail.
Activity
jfirebaugh commentedon Feb 23, 2017
For OpenGL ES 2.0, the minimum legal value for
GL_MAX_VERTEX_ATTRIBSis indeed 8. 😭anandthakker commentedon Feb 23, 2017
Based on some quick logging during attribute binding, it looks like the largest number of attributes we're currently using is in the circle program, at 14. Unfortunately, only 5 of the min/max pairs in this program are floats, so even if we packed them into vectors, we'd still be left with 9 > 8 attributes.
jfirebaugh commentedon Feb 23, 2017
Let's try a temporary branch that tries to bind an OpenGL ES 3.0 context here, and see if we get 16 vertex attributes that way.
anandthakker commentedon Feb 24, 2017
@jfirebaugh it looks like the ES 3.0 route is gonna be problematic:
{EGL_CONTEXT_CLIENT_VERSION, 3,..}fails withEGL_BAD_CONFIGandglGetString(GL_VERSION)yieldsOpenGL ES 2.0 (2.1 INTEL-10.22.29))jfirebaugh commentedon Feb 24, 2017
Do you actually have to declare API version 18 minimum to be able to create an ES 3.0 context? Or is that just the minimum version where support is guaranteed?
jfirebaugh commentedon Feb 24, 2017
Also, I would assume that
glGetString(GL_VERSION)returns you the version that the current context was created with, not necessarily the maximum supported version.anandthakker commentedon Feb 24, 2017
The docs aren't especially clear on that.
These docs, imply that it would show the highest supported version, even when the current context is created with a lower version.
zugaldia commentedon Feb 24, 2017
I don't know if this applies to the GL stack but, in general on Android, you can keep providing support for older API levels while using features only available at a higher API number. You can check for this at runtime. For example:
anandthakker commentedon Feb 24, 2017
@zugaldia my assumption was that the devices that are currently only allowing 8 attributes under ES 2.0 (and thus having this problem) would be highly correlated with the ones that have older API levels. If that's true, then unfortunately this wouldn't get us out of the bind we're in.
@jfirebaugh even without integer attributes, could we encode each color as a pair of (
highp) floats? If so, then a min/max pair of colors could be ahighp vec4, right? That would actually get us down to exactly 8 in the circle program. That's right at the boundary, which gives us no wiggle room, but the upside is that it's a (relatively) low-burden change...anandthakker commentedon Feb 24, 2017
Not that encoding/decoding floats is exactly straightforward
jfirebaugh commentedon Feb 24, 2017
Yeah, you can pack up to 24 integer bits in a single highp float, so I think that would work.
What total number of attributes are we looking at for the symbol shaders?
anandthakker commentedon Feb 24, 2017
With the dds paint properties from #7939 it'll be 14 for symbol shaders:
Packing min/max pairs together into vec4s would get us down to 9, but we could also combine
a_posanda_offsetinto a vec4.This leaves us no room for more, though, and so we'd be back to this problem soon.
jfirebaugh commentedon Feb 24, 2017
What's the total number assuming we DDS-enable the rest of the paint properties?
anandthakker commentedon Feb 24, 2017
@jfirebaugh I'm not sure. The remaining paint properties after 7939 are just
-translateand-translate-anchor, but we don't have a definite plan for those. One of the proposals in that ticket is to treat these like layout properties, but I don't yet understand what that would entail.