DebuggingGL 4.3
glPopDebugGroup
Closes the section opened by the last glPushDebugGroup.
Signature
void glPopDebugGroup(void);
How it works
Debug groups nest like brackets: every glPushDebugGroup needs one glPopDebugGroup, in reverse order. Tools such as RenderDoc and Nsight show the frame as a tree built from these pairs (Shadows › Cascade 2 › draw calls), which makes a capture of thousands of calls readable.
A simple way never to forget the pop is a small C++ object that pushes in its constructor and pops in its destructor.
Errors
When the call is invalid it does nothing and sets an error, which glGetError returns:
- GL_STACK_UNDERFLOW
- Called without a matching push.
Example
example.cpp
1struct GlDebugScope {
2 explicit GlDebugScope(const char* name) {
3 glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, name);
4 }
5 ~GlDebugScope() { glPopDebugGroup(); }
6};