Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] re-bind uniform locations after re-linking program (#11618)
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
Łukasz Paczos authored Apr 6, 2018
1 parent cc01781 commit 6f639db
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/mbgl/gl/program.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ class Program {
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>
Expand Down

0 comments on commit 6f639db

Please sign in to comment.