diff --git a/cocos/renderer/CCGLProgram.cpp b/cocos/renderer/CCGLProgram.cpp index b3004d4673..7b1d61f0c2 100644 --- a/cocos/renderer/CCGLProgram.cpp +++ b/cocos/renderer/CCGLProgram.cpp @@ -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); }