-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Reduce number of vertex attributes passed to shaders #8267
Conversation
@mollymerp, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh to be potential reviewers. |
Couple outstanding TODOs:
|
When source functions are used, this implementation will create vertex buffers that contain both min and max values, when only the min value is used. In other words, the buffers are twice as big as they need to be. We discussed an implementation where the vertex buffer contains only the min value, even though the shader continues to use a |
Ah, yep @jfirebaugh meant to put that on the todo list -- updated now. |
5ea3d41
to
7c1b63b
Compare
7c1b63b
to
4b25352
Compare
src/mbgl/programs/attributes.hpp
Outdated
static auto name() { | ||
static const std::string name = Attr::name() + std::string("_max"); | ||
static const std::string name = Attr::name(); |
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.
This can return Attr::name()
directly.
src/mbgl/programs/attributes.hpp
Outdated
static auto name() { return "a_stroke_color"; } | ||
|
||
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.
Nit: whitespace changes.
05a2ff9
to
6d2d7b4
Compare
Rebased back to master. Because of #8316 -- and the fact that we had multiple commits that modified the shaders, it was easier to first squash to a single commit before rebasing. (The history wasn't especially useful in this case anyway.) |
be7a504
to
46d4653
Compare
Some devices supported by Mapbox GL provide only 8 vertex attributes; this change packs existing attributes to get us just under that limit. For properties using a composite function, pack the min and max values into a single attribute with two logical components instead of using two separate attributes and buffers. Special logic is included for color attributes, whose integer components must be packed into the available bits of floating-point attributes. (We don't have access to ivec types in GL ES 2.0.) For source functions, continue to bind just a one-component attribute even though the GLSL type is vec2 (or vec4 for colors). The type-checking done by gl::Attribute is relaxed slightly to accommodate this.
46d4653
to
03f770c
Compare
fixes #8183
related gl-js PR: mapbox/mapbox-gl-js#4363
@anandthakker and I worked on this for the past couple days 🤖
cc @jfirebaugh