-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patherror.c
34 lines (29 loc) · 801 Bytes
/
error.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "shader/error.h"
#include <glad/glad.h>
#include <log.h>
#ifndef NDEBUG
const char *gl_error_string(int err) {
switch (err) {
case GL_INVALID_ENUM:
return "invalid enum";
case GL_INVALID_VALUE:
return "invalid value";
case GL_INVALID_OPERATION:
return "invalid operation";
case GL_INVALID_FRAMEBUFFER_OPERATION:
return "invalid framebuffer operation";
case GL_OUT_OF_MEMORY:
return "out of memory";
default:
return "unknown OpenGL error";
}
}
void gl_print_errors(int line, const char *expr, const char *file) {
GLenum err = glGetError();
while (err != GL_NO_ERROR) {
log_error("OpenGL error calling %s (%s: %d): %s", expr, file, line,
gl_error_string((int)err));
err = glGetError();
}
}
#endif