31 Oct 2019 • GL tricks: glPushDebugGroup

KHR_debug can do more than just spam you every time you call glBufferData, it also has a cool thing called debug groups. They don't do anything normally but you can use them to group related draw calls into collapsible lists in renderdoc. For example, here's a diesel engine frame:

They're very simple to use:

glPushDebugGroup( GL_DEBUG_SOURCE_APPLICATION, 0, -1, "Hello" );
...
glPopDebugGroup();

Put those calls in your render pass setup code, also check GLAD_GL_KHR_debug != 0 if you're still on pleb GL like we are, and you're done.