summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2018-04-03 15:59:35 +0300
committerIvo van Dongen <info@ivovandongen.nl>2018-04-03 15:59:35 +0300
commitae040c40e33cbe425774348980d333e018765014 (patch)
treebea4761639dfb9d3433f67e29b9d2fdd16ab992b
parent553efa38e3591ce62863d4d74222710f8e3c2337 (diff)
downloadqtlocation-mapboxgl-upstream/ivd-fix-android-emulator.tar.gz
[core] re-bind uniform locations after re-linking programupstream/ivd-fix-android-emulator
- 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>