diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-11-14 12:11:53 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-11-15 13:55:08 -0800 |
commit | 58877d1b3ddf0e4521d680b85e31b7a4c6287302 (patch) | |
tree | f844c8a12f82e40b1777ae79fe416c1eaa714470 /src/mbgl/gl/attribute.cpp | |
parent | 0fe8d8d7b4bbf136e8fb0f972cc31a94ddc4b67e (diff) | |
download | qtlocation-mapboxgl-58877d1b3ddf0e4521d680b85e31b7a4c6287302.tar.gz |
[core] Assign attribute locations sequentially
Two reasons to prefer explicit sequential location assignment, rather than relying on the GLSL linker to assign locations:
* For data-driven properties, we want to have the option to use glDisableVertexAttribArray plus glVertexAttrib*. In order to use glDisableVertexAttribArray, we must avoid using attribute location 0, which cannot be disabled.
* We want to use the same VAO in cases where, say, a fill layer might be rendered with FillProgram at first, and then FillPatternProgram later. VAOs do not store the program binding, only the attribute bindings, so as long as the two programs have the same attributes and attribute locations, only a single VAO (per segment) is needed.
Diffstat (limited to 'src/mbgl/gl/attribute.cpp')
-rw-r--r-- | src/mbgl/gl/attribute.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mbgl/gl/attribute.cpp b/src/mbgl/gl/attribute.cpp index 51fdd1dd12..7432fff590 100644 --- a/src/mbgl/gl/attribute.cpp +++ b/src/mbgl/gl/attribute.cpp @@ -4,8 +4,9 @@ namespace mbgl { namespace gl { -AttributeLocation attributeLocation(ProgramID id, const char* name) { - return MBGL_CHECK_ERROR(glGetAttribLocation(id, name)); +AttributeLocation bindAttributeLocation(ProgramID id, AttributeLocation location, const char* name) { + MBGL_CHECK_ERROR(glBindAttribLocation(id, location, name)); + return location; } void bindAttribute(AttributeLocation location, |