aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-08-12 08:21:18 -0400
committerGitHub <noreply@github.com>2017-08-12 08:21:18 -0400
commit53a53f55b4f2212fbe81e77beca85f45400e12de (patch)
tree3d54d0664fe73de8145ee57af890a818ec5b7e5b /render
parent65a899924221c3104800a8676852b34b0cd7223d (diff)
parent3ea878b76e7cf63caf9cddaaabe2faca053d9085 (diff)
Merge pull request #74 from martinetd/more_leaks
More leaks
Diffstat (limited to 'render')
-rw-r--r--render/gles2/renderer.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 237dc67b..c1bf4815 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -30,7 +30,7 @@ static bool compile_shader(GLuint type, const GLchar *src, GLuint *shader) {
GL_CALL(glGetShaderInfoLog(*shader, loglen, &loglen, msg));
wlr_log(L_ERROR, "Shader compilation failed");
wlr_log(L_ERROR, "%s", msg);
- exit(1);
+ glDeleteShader(*shader);
return false;
}
return true;
@@ -43,13 +43,32 @@ static bool compile_program(const GLchar *vert_src,
return false;
}
if (!compile_shader(GL_FRAGMENT_SHADER, frag_src, &fragment)) {
- glDeleteProgram(vertex);
+ glDeleteShader(vertex);
return false;
}
*program = GL_CALL(glCreateProgram());
GL_CALL(glAttachShader(*program, vertex));
GL_CALL(glAttachShader(*program, fragment));
GL_CALL(glLinkProgram(*program));
+ GLint success;
+ GL_CALL(glGetProgramiv(*program, GL_LINK_STATUS, &success));
+ if (success == GL_FALSE) {
+ GLint loglen;
+ GL_CALL(glGetProgramiv(*program, GL_INFO_LOG_LENGTH, &loglen));
+ GLchar msg[loglen];
+ GL_CALL(glGetProgramInfoLog(*program, loglen, &loglen, msg));
+ wlr_log(L_ERROR, "Program link failed");
+ wlr_log(L_ERROR, "%s", msg);
+ glDeleteProgram(*program);
+ glDeleteShader(vertex);
+ glDeleteShader(fragment);
+ return false;
+ }
+ glDetachShader(*program, vertex);
+ glDetachShader(*program, fragment);
+ glDeleteShader(vertex);
+ glDeleteShader(fragment);
+
return true;
}