summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-21 20:38:47 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-21 20:38:47 +0300
commita50b110c1d5a347158cdb8d28a68237b816797ac (patch)
tree100727bc3dfddb6754445671b972da8371ed955f /src
parent2da60f580cf07d16c0c52d451641bcb0e5698923 (diff)
downloadmv-a50b110c1d5a347158cdb8d28a68237b816797ac.tar.gz
mv-a50b110c1d5a347158cdb8d28a68237b816797ac.tar.bz2
mv-a50b110c1d5a347158cdb8d28a68237b816797ac.tar.xz
mv-a50b110c1d5a347158cdb8d28a68237b816797ac.zip
Validate shader program after compilation.
Diffstat (limited to 'src')
-rw-r--r--src/render/shaders/shadersmanager.cpp10
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);