mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-05 13:28:04 +03:00
Print shader compile error messages
This commit is contained in:
+7
-2
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user