From a50b110c1d5a347158cdb8d28a68237b816797ac Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 21 Jun 2014 20:38:47 +0300 Subject: Validate shader program after compilation. --- src/render/shaders/shadersmanager.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/render/shaders/shadersmanager.cpp b/src/render/shaders/shadersmanager.cpp index efaa97c77..7102bb747 100644 --- a/src/render/shaders/shadersmanager.cpp +++ b/src/render/shaders/shadersmanager.cpp @@ -95,7 +95,15 @@ ShaderProgram *ShadersManager::createProgram(const std::string &vertex, GLint isLinked = 0; mglGetProgramiv(programId, GL_LINK_STATUS, &isLinked); if (isLinked == GL_TRUE) - return new ShaderProgram(programId, vertexShader, fragmentShader); + { + mglValidateProgram(programId); + GLint isValidated = 0; + mglGetProgramiv(programId, GL_VALIDATE_STATUS, &isValidated); + if (isValidated == GL_TRUE) + return new ShaderProgram(programId, vertexShader, fragmentShader); + mglDeleteProgram(programId); + return nullptr; + } GLint len = 0; mglGetProgramiv(programId, GL_INFO_LOG_LENGTH, &len); -- cgit v1.2.3-70-g09d2