Print shader compile error messages

This commit is contained in:
kichikuou
2022-01-08 15:06:37 +09:00
parent 0aaef31666
commit cf6469c7c4
+7 -2
View File
@@ -101,8 +101,13 @@ static GLuint load_shader_file(const char *path, GLenum type)
glShaderSource(shader, 2, source, NULL);
glCompileShader(shader);
glGetShaderiv(shader, GL_COMPILE_STATUS, &shader_compiled);
if (!shader_compiled)
ERROR("Failed to compile shader: %s", path);
if (!shader_compiled) {
GLint len;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);
char *infolog = xmalloc(len + 1);
glGetShaderInfoLog(shader, len, NULL, infolog);
ERROR("Failed to compile shader %s: %s", path, infolog);
}
free((char*)source[1]);
return shader;
}