Improve shader compilation error;

This commit is contained in:
bjorn 2019-03-09 08:14:39 -08:00
parent e008ea7a28
commit c1705da8b7
1 changed files with 8 additions and 1 deletions

View File

@ -1631,7 +1631,14 @@ static GLuint compileShader(GLenum type, const char** sources, int count) {
char* log = malloc(logLength);
lovrAssert(log, "Out of memory");
glGetShaderInfoLog(shader, logLength, &logLength, log);
lovrThrow("Could not compile shader:\n%s", log);
const char* name;
switch (type) {
case GL_VERTEX_SHADER: name = "vertex shader"; break;
case GL_FRAGMENT_SHADER: name = "fragment shader"; break;
case GL_COMPUTE_SHADER: name = "compute shader"; break;
default: name = "shader"; break;
}
lovrThrow("Could not compile %s:\n%s", name, log);
}
return shader;