1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-18 23:10:26 +00:00

GLWRAP for debugging GL errors

This commit is contained in:
Zeno Rogue 2020-11-08 11:48:36 +01:00
parent b3db152ee6
commit 4373c03823

View File

@ -59,6 +59,24 @@ EX void glError(const char* GLcall, const char* file, const int line) {
} }
} }
#if HDR
struct glwrap {
const char* msg;
int line;
void act(const char *when);
glwrap(const char *m, int l) : msg(m), line(l) { act("before"); }
~glwrap() { act("after"); }
};
#define GLWRAP glwrap w##__line(__FILE__, __LINE__)
#endif
void glwrap::act(const char *when) {
GLenum errCode = glGetError();
if(errCode!=GL_NO_ERROR) {
println(hlog, format("GL error %i %s: %s:%i", errCode, when, msg, line));
}
}
#if HDR #if HDR
#if CAP_SHADER && CAP_NOSHADER #if CAP_SHADER && CAP_NOSHADER
#define WITHSHADER(x, y) if(glhr::noshaders) y else x #define WITHSHADER(x, y) if(glhr::noshaders) y else x