diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-21 20:38:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-21 20:38:47 +0300 |
commit | a50b110c1d5a347158cdb8d28a68237b816797ac (patch) | |
tree | 100727bc3dfddb6754445671b972da8371ed955f /src/render/shaders/shadersmanager.cpp | |
parent | 2da60f580cf07d16c0c52d451641bcb0e5698923 (diff) | |
download | manaplus-a50b110c1d5a347158cdb8d28a68237b816797ac.tar.gz manaplus-a50b110c1d5a347158cdb8d28a68237b816797ac.tar.bz2 manaplus-a50b110c1d5a347158cdb8d28a68237b816797ac.tar.xz manaplus-a50b110c1d5a347158cdb8d28a68237b816797ac.zip |
Validate shader program after compilation.
Diffstat (limited to 'src/render/shaders/shadersmanager.cpp')
-rw-r--r-- | src/render/shaders/shadersmanager.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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); |