Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-08-21 15:25:58 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-21 15:25:58 +0300
commit2e630297afc19ef4e69b8afe79dfd337171dbd60 (patch)
treeefdf43fd4c7b7369462dd0b231ceac94fbb30e5a /source/blender/gpu/opengl/gl_shader.cc
parent3a6e981bcd579b3fda039ff33f95d4baacc96465 (diff)
GPUShader: Fix linking working even if one shader compilation failed
Linking without valid shaders works on some drivers. Avoid this case by forcing linking step to return false.
Diffstat (limited to 'source/blender/gpu/opengl/gl_shader.cc')
-rw-r--r--source/blender/gpu/opengl/gl_shader.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc
index b2cca2ef45e..3ec818b53a6 100644
--- a/source/blender/gpu/opengl/gl_shader.cc
+++ b/source/blender/gpu/opengl/gl_shader.cc
@@ -151,6 +151,7 @@ GLuint GLShader::create_shader_stage(GLenum gl_stage, MutableSpan<const char *>
}
if (!status) {
glDeleteShader(shader);
+ compilation_failed_ = true;
return 0;
}
@@ -193,6 +194,10 @@ void GLShader::fragment_shader_from_glsl(MutableSpan<const char *> sources)
bool GLShader::finalize(void)
{
+ if (compilation_failed_) {
+ return false;
+ }
+
glLinkProgram(shader_program_);
GLint status;