summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorŁukasz Paczos <lukasz.paczos@mapbox.com>2018-04-06 16:28:36 +0200
committerGitHub <noreply@github.com>2018-04-06 16:28:36 +0200
commit6f639dba2028e02c85a28f32fcc854ee353f5b25 (patch)
treedd5021f1f05f2ef29fa15f3ff9ab541d5123ded2
parentcc01781db7281032f8c0c5eae54281187522a861 (diff)
downloadqtlocation-mapboxgl-6f639dba2028e02c85a28f32fcc854ee353f5b25.tar.gz
[core] re-bind uniform locations after re-linking program (#11618)
- On some gl implementations the uniform locations are shifted after linking the program a second time, resulting in errors when using any uniform. On some implementations they are actually doubled. Re-binding the uniforms after selectively binding the vertex attributes prevents this. (cherry picked from commit 4a0e025)
-rw-r--r--src/mbgl/gl/program.hpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp
index 3b54ec194a..af02ad3d54 100644
--- a/src/mbgl/gl/program.hpp
+++ b/src/mbgl/gl/program.hpp
@@ -36,8 +36,13 @@ public:
context.createShader(ShaderType::Fragment, fragmentSource))),
uniformsState((context.linkProgram(program), Uniforms::bindLocations(program))),
attributeLocations(Attributes::bindLocations(program)) {
+
// Re-link program after manually binding only active attributes in Attributes::bindLocations
context.linkProgram(program);
+
+ // We have to re-initialize the uniforms state from the bindings as the uniform locations
+ // get shifted on some implementations
+ uniformsState = Uniforms::bindLocations(program);
}
template <class BinaryProgram>