summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/program.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-11-14 12:11:53 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-11-15 13:55:08 -0800
commit58877d1b3ddf0e4521d680b85e31b7a4c6287302 (patch)
treef844c8a12f82e40b1777ae79fe416c1eaa714470 /src/mbgl/gl/program.hpp
parent0fe8d8d7b4bbf136e8fb0f972cc31a94ddc4b67e (diff)
downloadqtlocation-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/program.hpp')
-rw-r--r--src/mbgl/gl/program.hpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp
index 929237037b..44c16ae671 100644
--- a/src/mbgl/gl/program.hpp
+++ b/src/mbgl/gl/program.hpp
@@ -30,7 +30,7 @@ public:
fragmentShader(context.createShader(ShaderType::Fragment, fragmentSource)),
program(context.createProgram(vertexShader, fragmentShader)),
attributesState(Attributes::state(program)),
- uniformsState(Uniforms::state(program)) {}
+ uniformsState((context.linkProgram(program), Uniforms::state(program))) {}
// Indexed drawing.
template <class DrawMode>