diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2018-04-03 15:59:35 +0300 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2018-04-05 10:21:59 +0300 |
commit | 4a0e0251348806501f3e2f67eb868c6657aaf3b7 (patch) | |
tree | bea4761639dfb9d3433f67e29b9d2fdd16ab992b | |
parent | 553efa38e3591ce62863d4d74222710f8e3c2337 (diff) | |
download | qtlocation-mapboxgl-4a0e0251348806501f3e2f67eb868c6657aaf3b7.tar.gz |
[core] re-bind uniform locations after re-linking program
- 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.
-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> |