diff options
author | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2018-04-06 16:28:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-06 16:28:36 +0200 |
commit | 6f639dba2028e02c85a28f32fcc854ee353f5b25 (patch) | |
tree | dd5021f1f05f2ef29fa15f3ff9ab541d5123ded2 /src | |
parent | cc01781db7281032f8c0c5eae54281187522a861 (diff) | |
download | qtlocation-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)
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/gl/program.hpp | 5 |
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> |