nCine::GLDebug class

Wrapper around OpenGL debug output and object labelling.

All-static helper built on top of the KHR_debug functionality. Provides debug message groups, message insertion and object labels, all of which become no-ops when a debug context is not available.

Public types

class ScopedGroup
RAII scope for an OpenGL debug message group.
enum class LabelTypes { TransformFeedback = GL_TRANSFORM_FEEDBACK, Texture = GL_TEXTURE, RenderBuffer = GL_RENDERBUFFER, FrameBuffer = GL_FRAMEBUFFER, Buffer = GL_BUFFER, Shader = GL_SHADER, Program = GL_PROGRAM, VertexArray = GL_VERTEX_ARRAY, Query = GL_QUERY, ProgramPipeline = GL_PROGRAM_PIPELINE, Sampler = GL_SAMPLER }
OpenGL object types that can be labelled.

Public static functions

static void Init(const IGfxCapabilities& gfxCaps)
Queries debug capabilities and enables debug output if available.
static void Reset()
Resets the running debug group id counter.
static auto IsAvailable() -> bool
Returns whether OpenGL debug output is available.
static void PushGroup(StringView message)
Pushes a named debug group.
static void PopGroup()
Pops the most recently pushed debug group.
static void MessageInsert(StringView message)
Inserts a one-off debug marker message.
static void SetObjectLabel(LabelTypes identifier, GLuint name, StringView label)
Sets a human-readable label on an OpenGL object.
static void GetObjectLabel(LabelTypes identifier, GLuint name, GLsizei bufSize, GLsizei* length, char* label)
Retrieves the label of an OpenGL object.
static auto GetMaxLabelLength() -> std::int32_t
Returns the maximum supported object label length.

Enum documentation

enum class nCine::GLDebug::LabelTypes

OpenGL object types that can be labelled.

Maps to the OpenGL object identifier enums accepted by glObjectLabel().

Function documentation

static void nCine::GLDebug::Init(const IGfxCapabilities& gfxCaps)

Queries debug capabilities and enables debug output if available.

Parameters
gfxCaps Graphics capabilities used to detect KHR_debug support

static void nCine::GLDebug::SetObjectLabel(LabelTypes identifier, GLuint name, StringView label)

Sets a human-readable label on an OpenGL object.

Parameters
identifier Type of the object being labelled
name Name (id) of the object
label Label to assign

static void nCine::GLDebug::GetObjectLabel(LabelTypes identifier, GLuint name, GLsizei bufSize, GLsizei* length, char* label)

Retrieves the label of an OpenGL object.

Parameters
identifier Type of the object being queried
name Name (id) of the object
bufSize Size of the destination buffer
length Receives the number of characters written (may be nullptr)
label Destination buffer for the label