Merge pull request #16232 from perminovVS/gl-program-link-status

GLProgram::link always check link status
This commit is contained in:
Ricardo Quesada 2016-07-27 10:48:02 -07:00 committed by GitHub
commit 1e1fad8b04
1 changed files with 12 additions and 7 deletions

View File

@ -565,12 +565,11 @@ bool GLProgram::link()
glLinkProgram(_program);
parseVertexAttribs();
parseUniforms();
clearShader();
#if DEBUG || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// Calling glGetProgramiv(...GL_LINK_STATUS...) will force linking of the program at this moment.
// Otherwise, they might be linked when they are used for the first time. (I guess this depends on the driver implementation)
// So it might slow down the "booting" process on certain devices. But, on the other hand it is important to know if the shader
// linked succesfully. Some shaders might be downloaded in runtime so, release version should have this check.
// For more info, see Github issue #16231
glGetProgramiv(_program, GL_LINK_STATUS, &status);
if (status == GL_FALSE)
@ -579,7 +578,13 @@ bool GLProgram::link()
GL::deleteProgram(_program);
_program = 0;
}
#endif
else
{
parseVertexAttribs();
parseUniforms();
clearShader();
}
return (status == GL_TRUE);
}