Magnum::GL::PipelineStatisticsQuery class new in 2020.06

Pipeline statistics query.

Provides various data about the rendering pipeline, useful for profiling and performance measurements.

Base classes

class AbstractQuery
Base class for queries.

Public types

enum class Target: GLenum { VerticesSubmitted = GL_VERTICES_SUBMITTED, PrimitivesSubmitted = GL_PRIMITIVES_SUBMITTED, VertexShaderInvocations = GL_VERTEX_SHADER_INVOCATIONS, TessellationControlShaderPatches = GL_TESS_CONTROL_SHADER_PATCHES, TessellationEvaluationShaderInvocations = GL_TESS_EVALUATION_SHADER_INVOCATIONS, GeometryShaderInvocations = GL_GEOMETRY_SHADER_INVOCATIONS, GeometryShaderPrimitivesEmitted = GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED, FragmentShaderInvocations = GL_FRAGMENT_SHADER_INVOCATIONS, ComputeShaderInvocations = GL_COMPUTE_SHADER_INVOCATIONS, ClippingInputPrimitives = GL_CLIPPING_INPUT_PRIMITIVES, ClippingOutputPrimitives = GL_CLIPPING_OUTPUT_PRIMITIVES }
Query target.

Public static functions

static auto wrap(GLuint id, Target target, ObjectFlags flags = {}) -> PipelineStatisticsQuery
Wrap existing OpenGL time query object.

Constructors, destructors, conversion operators

PipelineStatisticsQuery(Target target) explicit
PipelineStatisticsQuery(NoCreateT) explicit noexcept
Construct without creating the underlying OpenGL object.
PipelineStatisticsQuery(const PipelineStatisticsQuery&) deleted
Copying is not allowed.
PipelineStatisticsQuery(PipelineStatisticsQuery&&) defaulted noexcept
Move constructor.

Public functions

auto operator=(const PipelineStatisticsQuery&) -> PipelineStatisticsQuery& deleted
Copying is not allowed.
auto operator=(PipelineStatisticsQuery&&) -> PipelineStatisticsQuery& defaulted noexcept
Move assignment.

Enum documentation

enum class Magnum::GL::PipelineStatisticsQuery::Target: GLenum

Query target.


Count of vertices submitted to the primitive assembler. Note that this doesn't take index buffer or strips/fans into account.


Count of primitives submitted to the primitive assembler.


Count of vertex shader invocations. For indexed draws this is usually less than Target::VerticesSubmitted, depending on how well is the post-transform vertex cache used.


Count of patches processed by tessellation control shader stage.


Count of tessellation evaluation shader invocations.


Count of geometry shader invocations.


Count of primitives emitted by a geometry shader. Compared to PrimitiveQuery::Target::PrimitivesGenerated, the query considers all vertex streams and implementation may not count primitives that aren't processed further.


Count of fragment shader invocations.


Count of compute shader invocations.


Count of primitives that entered the clipping stage.


Count of primitives that passed the clipping stage. In an ideal case of CPU-side frustum culling, the value reported by this query is the same as Target::ClippingInputPrimitives.

Function documentation

static PipelineStatisticsQuery Magnum::GL::PipelineStatisticsQuery::wrap(GLuint id, Target target, ObjectFlags flags = {})

Wrap existing OpenGL time query object.

id OpenGL time query ID
target Query target
flags Object creation flags

The id is expected to be of an existing OpenGL query object. Unlike query created using constructor, the OpenGL object is by default not deleted on destruction, use flags for different behavior.

Magnum::GL::PipelineStatisticsQuery::PipelineStatisticsQuery(Target target) explicit


Creates new OpenGL query object. If ARB_direct_state_access (part of OpenGL 4.5) is not available, the query is created on first use.

Magnum::GL::PipelineStatisticsQuery::PipelineStatisticsQuery(NoCreateT) explicit noexcept

Construct without creating the underlying OpenGL object.

The constructed instance is equivalent to moved-from state. Useful in cases where you will overwrite the instance later anyway. Move another object over it to make it useful.

This function can be safely used for constructing (and later destructing) objects even without any OpenGL context being active. However note that this is a low-level and a potentially dangerous API, see the documentation of NoCreate for alternatives.