15#define _VA_ARG_LIST1(t) t
16#define _VA_ARG_LIST2(t, a) t a
17#define _VA_ARG_LIST4(t, a, b, c) \
18 _VA_ARG_LIST2(t, a), _VA_ARG_LIST2(b, c)
19#define _VA_ARG_LIST6(t, a, b, c, d, e) \
20 _VA_ARG_LIST2(t, a), _VA_ARG_LIST4(b, c, d, e)
21#define _VA_ARG_LIST8(t, a, b, c, d, e, f, g) \
22 _VA_ARG_LIST2(t, a), _VA_ARG_LIST6(b, c, d, e, f, g)
23#define _VA_ARG_LIST10(t, a, b, c, d, e, f, g, h, i) \
24 _VA_ARG_LIST2(t, a), _VA_ARG_LIST8(b, c, d, e, f, g, h, i)
25#define _VA_ARG_LIST12(t, a, b, c, d, e, f, g, h, i, j, k) \
26 _VA_ARG_LIST2(t, a), _VA_ARG_LIST10(b, c, d, e, f, g, h, i, j, k)
27#define _VA_ARG_LIST14(t, a, b, c, d, e, f, g, h, i, j, k, l, m) \
28 _VA_ARG_LIST2(t, a), _VA_ARG_LIST12(b, c, d, e, f, g, h, i, j, k, l, m)
29#define _VA_ARG_LIST16(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p) \
30 _VA_ARG_LIST2(t, a), _VA_ARG_LIST14(b, c, d, e, f, g, h, i, j, k, l, m, o, p)
31#define _VA_ARG_LIST18(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r) \
32 _VA_ARG_LIST2(t, a), _VA_ARG_LIST16(b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r)
33#define _VA_ARG_LIST20(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r, s, u) \
34 _VA_ARG_LIST2(t, a), _VA_ARG_LIST18(b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r, s, u)
35#define _VA_ARG_LIST22(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r, s, u, v, w) \
36 _VA_ARG_LIST2(t, a), _VA_ARG_LIST20(b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r, s, u, v, w)
37#define ARG_LIST(...) VA_NARGS_CALL_OVERLOAD(_VA_ARG_LIST, __VA_ARGS__)
39#define _VA_ARG_LIST_CALL1(t)
40#define _VA_ARG_LIST_CALL2(t, a) a
41#define _VA_ARG_LIST_CALL4(t, a, b, c) \
42 _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL2(b, c)
43#define _VA_ARG_LIST_CALL6(t, a, b, c, d, e) \
44 _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL4(b, c, d, e)
45#define _VA_ARG_LIST_CALL8(t, a, b, c, d, e, f, g) \
46 _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL6(b, c, d, e, f, g)
47#define _VA_ARG_LIST_CALL10(t, a, b, c, d, e, f, g, h, i) \
48 _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL8(b, c, d, e, f, g, h, i)
49#define _VA_ARG_LIST_CALL12(t, a, b, c, d, e, f, g, h, i, j, k) \
50 _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL10(b, c, d, e, f, g, h, i, j, k)
51#define _VA_ARG_LIST_CALL14(t, a, b, c, d, e, f, g, h, i, j, k, l, m) \
52 _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL12(b, c, d, e, f, g, h, i, j, k, l, m)
53#define _VA_ARG_LIST_CALL16(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p) \
54 _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL14(b, c, d, e, f, g, h, i, j, k, l, m, o, p)
55#define _VA_ARG_LIST_CALL18(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r) \
56 _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL16(b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r)
57#define _VA_ARG_LIST_CALL20(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r, s, u) \
58 _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL18(b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r, s, u)
59#define _VA_ARG_LIST_CALL22(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r, s, u, v, w) \
60 _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL20(b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r, s, u, v, w)
61#define ARG_LIST_CALL(...) VA_NARGS_CALL_OVERLOAD(_VA_ARG_LIST_CALL, __VA_ARGS__)
65# define GL_CHECK_RESOURCES(info) debug::check_gl_resources(info)
67# define GL_CHECK_RESOURCES(info)
89void object_label(GLenum type, GLuint
object,
const char *name);
93#define DEBUG_FUNC_OVERRIDE(func, ...) \
94 inline void func(ARG_LIST(__VA_ARGS__)) \
96 if (GLContext::debug_layer_workaround) { \
97 debug::check_gl_error("generated before " #func); \
98 ::func(ARG_LIST_CALL(__VA_ARGS__)); \
99 debug::check_gl_error("" #func); \
102 ::func(ARG_LIST_CALL(__VA_ARGS__)); \
114DEBUG_FUNC_OVERRIDE(glGetTexImage, GLenum, target, GLint, level, GLenum,
format, GLenum, type,
void *, pixels);
116DEBUG_FUNC_OVERRIDE(glReadPixels, GLint, x, GLint, y, GLsizei, width, GLsizei, height, GLenum,
format, GLenum, type,
void *, pixels);
117DEBUG_FUNC_OVERRIDE(glTexImage1D, GLenum, target, GLint, level, GLint, internalformat, GLsizei, width, GLint, border, GLenum,
format, GLenum, type,
const void *, pixels);
118DEBUG_FUNC_OVERRIDE(glTexImage2D, GLenum, target, GLint, level, GLint, internalformat, GLsizei, width, GLsizei, height, GLint, border, GLenum,
format, GLenum, type,
const void *, pixels);
121DEBUG_FUNC_OVERRIDE(glTexSubImage1D, GLenum, target, GLint, level, GLint, xoffset, GLsizei, width, GLenum,
format, GLenum, type,
const void *, pixels);
122DEBUG_FUNC_OVERRIDE(glTexSubImage2D, GLenum, target, GLint, level, GLint, xoffset, GLint, yoffset, GLsizei, width, GLsizei, height, GLenum,
format, GLenum, type,
const void *, pixels);
#define DEBUG_FUNC_OVERRIDE(func,...)
void check_gl_resources(const char *info)
void raise_gl_error(const char *info)
void check_gl_error(const char *info)
void object_label(GLenum type, GLuint object, const char *name)