class
#include <Magnum/GL/DebugOutput.h>
DebugGroup Debug group.
Allows marking portions of GL command stream with labels, useful for example with conjunction with various graphics debuggers, such as Apitrace or gDEBugger.
Basic usage
See DebugOutput for introduction.
Easiest way is to push debug group by creating instance and pop it automatically at the end of scope:
{ /* Push debug group */ GL::DebugGroup group{GL::DebugGroup::Source::Application, 42, "Scene rendering"}; GL::Renderer::enable(GL::Renderer::Feature::Blending); shader.draw(mesh); GL::Renderer::disable(GL::Renderer::Feature::Blending); /* The debug group is popped automatically at the end of the scope */ }
If, for some reason, you need to pop in different scope, you can call push() and pop() manually:
GL::DebugGroup group; group.push(GL::DebugGroup::Source::Application, 42, "Scene rendering"); GL::Renderer::enable(GL::Renderer::Feature::Blending); shader.draw(mesh); GL::Renderer::disable(GL::Renderer::Feature::Blending); group.pop();
If OpenGL 4.3 / OpenGL ES 3.2 is supported or KHR_
Debug output: application debug group enter (42): Scene rendering Debug output: application debug group leave (42): Scene rendering
If only EXT_
If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither KHR_
Interaction with debug output volume control
Besides putting hierarchical messages in debug output, the group also affects settings done by DebugOutput::
Performance notes
If you ensure that you always use the const char
overload of push() and the debug output is either not supported or turned off, the calls will not result in any allocations and thus won't have any negative performance effects.
Public types
- enum class Source: GLenum { ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY, Application = GL_DEBUG_SOURCE_APPLICATION }
- Message source.
Public static functions
- static auto maxStackDepth() -> Int
- Max debug group stack depth.
Constructors, destructors, conversion operators
- DebugGroup() explicit
- Default constructor.
-
DebugGroup(Source source,
UnsignedInt id,
Containers::
StringView message) explicit - Constructor.
- ~DebugGroup()
- Destructor.
Public functions
-
void push(Source source,
UnsignedInt id,
Containers::
StringView message) - Push debug group onto the stack.
- void pop()
- Pop debug group from the stack.
Enum documentation
enum class Magnum:: GL:: DebugGroup:: Source: GLenum
Message source.
Enumerators | |
---|---|
ThirdParty |
External debugger or third-party middleware |
Application |
The application |
Function documentation
static Int Magnum:: GL:: DebugGroup:: maxStackDepth()
Max debug group stack depth.
The result is cached, repeated queries don't result in repeated OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and KHR_0
.
Magnum:: GL:: DebugGroup:: DebugGroup() explicit
Default constructor.
Doesn't do anything. Call push() to enter debug group.
Magnum:: GL:: DebugGroup:: DebugGroup(Source source,
UnsignedInt id,
Containers:: StringView message) explicit
Constructor.
Calls push().
void Magnum:: GL:: DebugGroup:: push(Source source,
UnsignedInt id,
Containers:: StringView message)
Push debug group onto the stack.
Expects that the group isn't already pushed on the stack. The group entering message is put into debug output with DebugOutput::
If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither KHR_message
is used and all other parameters are ignored.
void Magnum:: GL:: DebugGroup:: pop()
Pop debug group from the stack.
Expects that the group is currently pushed on the stack. Leaving the group will also revert all DebugOutput::
If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither KHR_
Debug& operator<<(Debug& debug,
DebugGroup:: Source value)
Debug output operator.