8 #ifndef hifi_gpu_gl_GLQuery_h
9 #define hifi_gpu_gl_GLQuery_h
12 #include "GLBackend.h"
14 namespace gpu {
namespace gl {
16 class GLQuery :
public GLObject<Query> {
17 using Parent = gpu::gl::GLObject<Query>;
19 template <
typename GLQueryType>
20 static GLQueryType* sync(GLBackend& backend,
const Query& query) {
21 GLQueryType*
object = Backend::getGPUObject<GLQueryType>(query);
26 object =
new GLQueryType(backend.shared_from_this(), query);
27 (void)CHECK_GL_ERROR();
28 Backend::setGPUObject(query,
object);
34 template <
typename GLQueryType>
35 static GLuint getId(GLBackend& backend,
const QueryPointer& query) {
40 GLQuery*
object = sync<GLQueryType>(backend, *query);
45 return object->_endqo;
48 const GLuint& _endqo = { _id };
49 const GLuint _beginqo = { 0 };
50 GLuint64 _result { (GLuint64)0 };
51 GLuint64 _batchElapsedTime{ (GLuint64)0 };
52 std::chrono::high_resolution_clock::time_point _batchElapsedTimeBegin;
53 uint64_t _profileRangeId { 0 };
54 uint32_t _rangeQueryDepth { 0 };
57 GLQuery(
const std::weak_ptr<GLBackend>& backend,
const Query& query, GLuint endId, GLuint beginId) : Parent(backend, query, endId), _beginqo(beginId) {}
60 GLuint ids[2] = { _endqo, _beginqo };
61 glDeleteQueries(2, ids);