Blender  V3.3
Namespaces | Macros | Functions
gl_debug.hh File Reference
#include "gl_context.hh"
#include "glew-mx.h"

Go to the source code of this file.

Namespaces

 blender
 
 blender::gpu
 
 blender::gpu::debug
 

Macros

#define _VA_ARG_LIST1(t)   t
 
#define _VA_ARG_LIST2(t, a)   t a
 
#define _VA_ARG_LIST4(t, a, b, c)    _VA_ARG_LIST2(t, a), _VA_ARG_LIST2(b, c)
 
#define _VA_ARG_LIST6(t, a, b, c, d, e)    _VA_ARG_LIST2(t, a), _VA_ARG_LIST4(b, c, d, e)
 
#define _VA_ARG_LIST8(t, a, b, c, d, e, f, g)    _VA_ARG_LIST2(t, a), _VA_ARG_LIST6(b, c, d, e, f, g)
 
#define _VA_ARG_LIST10(t, a, b, c, d, e, f, g, h, i)    _VA_ARG_LIST2(t, a), _VA_ARG_LIST8(b, c, d, e, f, g, h, i)
 
#define _VA_ARG_LIST12(t, a, b, c, d, e, f, g, h, i, j, k)    _VA_ARG_LIST2(t, a), _VA_ARG_LIST10(b, c, d, e, f, g, h, i, j, k)
 
#define _VA_ARG_LIST14(t, a, b, c, d, e, f, g, h, i, j, k, l, m)    _VA_ARG_LIST2(t, a), _VA_ARG_LIST12(b, c, d, e, f, g, h, i, j, k, l, m)
 
#define _VA_ARG_LIST16(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p)    _VA_ARG_LIST2(t, a), _VA_ARG_LIST14(b, c, d, e, f, g, h, i, j, k, l, m, o, p)
 
#define _VA_ARG_LIST18(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r)    _VA_ARG_LIST2(t, a), _VA_ARG_LIST16(b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r)
 
#define _VA_ARG_LIST20(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r, s, u)    _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)
 
#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)    _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)
 
#define ARG_LIST(...)   VA_NARGS_CALL_OVERLOAD(_VA_ARG_LIST, __VA_ARGS__)
 
#define _VA_ARG_LIST_CALL1(t)
 
#define _VA_ARG_LIST_CALL2(t, a)   a
 
#define _VA_ARG_LIST_CALL4(t, a, b, c)    _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL2(b, c)
 
#define _VA_ARG_LIST_CALL6(t, a, b, c, d, e)    _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL4(b, c, d, e)
 
#define _VA_ARG_LIST_CALL8(t, a, b, c, d, e, f, g)    _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL6(b, c, d, e, f, g)
 
#define _VA_ARG_LIST_CALL10(t, a, b, c, d, e, f, g, h, i)    _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL8(b, c, d, e, f, g, h, i)
 
#define _VA_ARG_LIST_CALL12(t, a, b, c, d, e, f, g, h, i, j, k)    _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL10(b, c, d, e, f, g, h, i, j, k)
 
#define _VA_ARG_LIST_CALL14(t, a, b, c, d, e, f, g, h, i, j, k, l, m)    _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL12(b, c, d, e, f, g, h, i, j, k, l, m)
 
#define _VA_ARG_LIST_CALL16(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p)    _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL14(b, c, d, e, f, g, h, i, j, k, l, m, o, p)
 
#define _VA_ARG_LIST_CALL18(t, a, b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r)    _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)
 
#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)    _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)
 
#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)    _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)
 
#define ARG_LIST_CALL(...)   VA_NARGS_CALL_OVERLOAD(_VA_ARG_LIST_CALL, __VA_ARGS__)
 
#define GL_CHECK_RESOURCES(info)
 
#define DEBUG_FUNC_OVERRIDE(func, ...)
 

Functions

void blender::gpu::debug::init_debug_layer ()
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glClear, GLbitfield, mask)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glDeleteTextures, GLsizei, n, const GLuint *, textures)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glDrawArrays, GLenum, mode, GLint, first, GLsizei, count)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glFinish, void)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glFlush, void)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glGenTextures, GLsizei, n, GLuint *, textures)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glGetTexImage, GLenum, target, GLint, level, GLenum, format, GLenum, type, void *, pixels)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glReadBuffer, GLenum, mode)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glReadPixels, GLint, x, GLint, y, GLsizei, width, GLsizei, height, GLenum, format, GLenum, type, void *, pixels)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glTexImage1D, GLenum, target, GLint, level, GLint, internalformat, GLsizei, width, GLint, border, GLenum, format, GLenum, type, const void *, pixels)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glTexImage2D, GLenum, target, GLint, level, GLint, internalformat, GLsizei, width, GLsizei, height, GLint, border, GLenum, format, GLenum, type, const void *, pixels)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glTexParameteri, GLenum, target, GLenum, pname, GLint, param)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glTexParameteriv, GLenum, target, GLenum, pname, const GLint *, params)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glTexSubImage1D, GLenum, target, GLint, level, GLint, xoffset, GLsizei, width, GLenum, format, GLenum, type, const void *, pixels)
 
 blender::gpu::DEBUG_FUNC_OVERRIDE (glTexSubImage2D, GLenum, target, GLint, level, GLint, xoffset, GLint, yoffset, GLsizei, width, GLsizei, height, GLenum, format, GLenum, type, const void *, pixels)
 
Error Checking

This is only useful for implementation that does not support the KHR_debug extension OR when the implementations do not report any errors even when clearly doing shady things.

void blender::gpu::debug::raise_gl_error (const char *info)
 
void blender::gpu::debug::check_gl_error (const char *info)
 
void blender::gpu::debug::check_gl_resources (const char *info)
 
Debug Callbacks

Hooks up debug callbacks to a debug OpenGL context using extensions or 4.3 core debug capabilities.

void blender::gpu::debug::init_gl_callbacks ()
 
Object Label

Useful for debugging through render-doc. Only defined if using --debug-gpu. Make sure to bind the object first so that it gets defined by the GL implementation.

void blender::gpu::debug::object_label (GLenum type, GLuint object, const char *name)
 

Macro Definition Documentation

◆ _VA_ARG_LIST1

#define _VA_ARG_LIST1 (   t)    t

Definition at line 15 of file gl_debug.hh.

◆ _VA_ARG_LIST10

#define _VA_ARG_LIST10 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
 
)     _VA_ARG_LIST2(t, a), _VA_ARG_LIST8(b, c, d, e, f, g, h, i)

Definition at line 23 of file gl_debug.hh.

◆ _VA_ARG_LIST12

#define _VA_ARG_LIST12 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
 
)     _VA_ARG_LIST2(t, a), _VA_ARG_LIST10(b, c, d, e, f, g, h, i, j, k)

Definition at line 25 of file gl_debug.hh.

◆ _VA_ARG_LIST14

#define _VA_ARG_LIST14 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l,
 
)     _VA_ARG_LIST2(t, a), _VA_ARG_LIST12(b, c, d, e, f, g, h, i, j, k, l, m)

Definition at line 27 of file gl_debug.hh.

◆ _VA_ARG_LIST16

#define _VA_ARG_LIST16 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l,
  m,
  o,
 
)     _VA_ARG_LIST2(t, a), _VA_ARG_LIST14(b, c, d, e, f, g, h, i, j, k, l, m, o, p)

Definition at line 29 of file gl_debug.hh.

◆ _VA_ARG_LIST18

#define _VA_ARG_LIST18 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l,
  m,
  o,
  p,
  q,
  r 
)     _VA_ARG_LIST2(t, a), _VA_ARG_LIST16(b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r)

Definition at line 31 of file gl_debug.hh.

◆ _VA_ARG_LIST2

#define _VA_ARG_LIST2 (   t,
 
)    t a

Definition at line 16 of file gl_debug.hh.

◆ _VA_ARG_LIST20

#define _VA_ARG_LIST20 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l,
  m,
  o,
  p,
  q,
  r,
  s,
 
)     _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)

Definition at line 33 of file gl_debug.hh.

◆ _VA_ARG_LIST22

#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 
)     _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)

Definition at line 35 of file gl_debug.hh.

◆ _VA_ARG_LIST4

#define _VA_ARG_LIST4 (   t,
  a,
  b,
 
)     _VA_ARG_LIST2(t, a), _VA_ARG_LIST2(b, c)

Definition at line 17 of file gl_debug.hh.

◆ _VA_ARG_LIST6

#define _VA_ARG_LIST6 (   t,
  a,
  b,
  c,
  d,
  e 
)     _VA_ARG_LIST2(t, a), _VA_ARG_LIST4(b, c, d, e)

Definition at line 19 of file gl_debug.hh.

◆ _VA_ARG_LIST8

#define _VA_ARG_LIST8 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
 
)     _VA_ARG_LIST2(t, a), _VA_ARG_LIST6(b, c, d, e, f, g)

Definition at line 21 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL1

#define _VA_ARG_LIST_CALL1 (   t)

Definition at line 39 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL10

#define _VA_ARG_LIST_CALL10 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
 
)     _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL8(b, c, d, e, f, g, h, i)

Definition at line 47 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL12

#define _VA_ARG_LIST_CALL12 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
 
)     _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL10(b, c, d, e, f, g, h, i, j, k)

Definition at line 49 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL14

#define _VA_ARG_LIST_CALL14 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l,
 
)     _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL12(b, c, d, e, f, g, h, i, j, k, l, m)

Definition at line 51 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL16

#define _VA_ARG_LIST_CALL16 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l,
  m,
  o,
 
)     _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL14(b, c, d, e, f, g, h, i, j, k, l, m, o, p)

Definition at line 53 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL18

#define _VA_ARG_LIST_CALL18 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l,
  m,
  o,
  p,
  q,
  r 
)     _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)

Definition at line 55 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL2

#define _VA_ARG_LIST_CALL2 (   t,
 
)    a

Definition at line 40 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL20

#define _VA_ARG_LIST_CALL20 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l,
  m,
  o,
  p,
  q,
  r,
  s,
 
)     _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)

Definition at line 57 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL22

#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 
)     _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)

Definition at line 59 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL4

#define _VA_ARG_LIST_CALL4 (   t,
  a,
  b,
 
)     _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL2(b, c)

Definition at line 41 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL6

#define _VA_ARG_LIST_CALL6 (   t,
  a,
  b,
  c,
  d,
  e 
)     _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL4(b, c, d, e)

Definition at line 43 of file gl_debug.hh.

◆ _VA_ARG_LIST_CALL8

#define _VA_ARG_LIST_CALL8 (   t,
  a,
  b,
  c,
  d,
  e,
  f,
 
)     _VA_ARG_LIST_CALL2(t, a), _VA_ARG_LIST_CALL6(b, c, d, e, f, g)

Definition at line 45 of file gl_debug.hh.

◆ ARG_LIST

#define ARG_LIST (   ...)    VA_NARGS_CALL_OVERLOAD(_VA_ARG_LIST, __VA_ARGS__)

Definition at line 37 of file gl_debug.hh.

◆ ARG_LIST_CALL

#define ARG_LIST_CALL (   ...)    VA_NARGS_CALL_OVERLOAD(_VA_ARG_LIST_CALL, __VA_ARGS__)

Definition at line 61 of file gl_debug.hh.

◆ DEBUG_FUNC_OVERRIDE

#define DEBUG_FUNC_OVERRIDE (   func,
  ... 
)
Value:
inline void func(ARG_LIST(__VA_ARGS__)) \
{ \
if (GLContext::debug_layer_workaround) { \
debug::check_gl_error("generated before " #func); \
::func(ARG_LIST_CALL(__VA_ARGS__)); \
} \
else { \
::func(ARG_LIST_CALL(__VA_ARGS__)); \
} \
}
#define ARG_LIST(...)
Definition: gl_debug.hh:37
#define ARG_LIST_CALL(...)
Definition: gl_debug.hh:61
void check_gl_error(const char *info)
Definition: gl_debug.cc:181

Definition at line 93 of file gl_debug.hh.

◆ GL_CHECK_RESOURCES

#define GL_CHECK_RESOURCES (   info)

Definition at line 67 of file gl_debug.hh.