DebuggingGL 4.3
glPushDebugGroup
Opens a named section of commands, shown as a collapsible group in RenderDoc and similar tools.
Signature
void glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const char *message);
How it works
Wrap each pass of your frame ("Shadow pass", "G-buffer", "Bloom") in a push/pop pair. When you capture a frame, the hundreds of calls become a tidy tree.
Parameters
sourceGLenum
Use GL_DEBUG_SOURCE_APPLICATION.
idGLuint
Any number of your choice.
lengthGLsizei
Message length, or -1 if null-terminated.
messageconst char *
Group name.
Tips & pitfalls
Every push needs a matching
glPopDebugGroup— a small RAII struct makes that automatic.
Example
example.cpp
1glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, "Shadow pass");
2renderShadowMap();
3glPopDebugGroup();