Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
GPUQuery Class Reference

Represent a GPU query, automatically buffered and retrieved. More...

#include <GPUTypes.hpp>

Public Types

enum class  Type : uint { TIME_ELAPSED , SAMPLES_DRAWN , ANY_DRAWN }
 

Public Member Functions

 GPUQuery (Type type=GPUQuery::Type::TIME_ELAPSED)
 
void begin ()
 
void end ()
 
uint64_t value ()
 

Private Attributes

Type _type = GPUQuery::Type::TIME_ELAPSED
 The type of query.
 
uint _count = 2
 Number of queries used internally (two for duration queries)
 
uint _offset = 0
 Offset of the first query in the query pools.
 
bool _ranThisFrame = false
 Has the query been run this frame (else we won't fetch its value).
 
bool _running = false
 Is a measurement currently taking place.
 

Detailed Description

Represent a GPU query, automatically buffered and retrieved.

Warning
You cannot have multiple queries of the same type running at the same time.

Member Enumeration Documentation

◆ Type

enum class GPUQuery::Type : uint
strong

Type for query to perform.

Enumerator
TIME_ELAPSED 

Time taken by GPU operations between the beginning and end of the query.

SAMPLES_DRAWN 

Number of samples passing the tests while the query is active.

ANY_DRAWN 

Was any sample drawn while the query was active.

Constructor & Destructor Documentation

◆ GPUQuery()

GPUQuery::GPUQuery ( Type  type = GPUQuery::Type::TIME_ELAPSED)

Constructor.

Parameters
typethe metric to query

Member Function Documentation

◆ begin()

void GPUQuery::begin ( )

Start measuring the metric.

◆ end()

void GPUQuery::end ( )

End the measurement.

◆ value()

uint64_t GPUQuery::value ( )

Query the metric measured at the last frame. Unit used is nanoseconds for timing queries, number of samples for occlusion queries.

Returns
the raw metric value

The documentation for this class was generated from the following files: