summaryrefslogtreecommitdiff
path: root/src/render/shaders/shadersmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/shaders/shadersmanager.cpp')
-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);