summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2018-04-03 15:59:35 +0300
committerTobrun <tobrun@mapbox.com>2018-04-10 15:49:01 +0200
commit46d3756cbd537fdde57f6ec64497b97c6050cb4d (patch)
treecc5106a5ed7f1755ad771925d7ea11e44f9cbf4d
parent88d21e17dc218638fad232c050e67797a3c5cb9d (diff)
downloadqtlocation-mapboxgl-46d3756cbd537fdde57f6ec64497b97c6050cb4d.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.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>