[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)
This commit is contained in:
Łukasz Paczos
2018-04-06 16:28:36 +02:00
committed by GitHub
parent cc01781db7
commit 6f639dba20

View File

@@ -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>