diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackendQuery.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackendQuery.cpp index b64804fe7c..a448fceffe 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackendQuery.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackendQuery.cpp @@ -32,7 +32,8 @@ void GLBackend::do_beginQuery(const Batch& batch, size_t paramOffset) { PROFILE_RANGE_BEGIN(render_gpu_gl_detail, glquery->_profileRangeId, query->getName().c_str(), 0xFFFF7F00); ++_queryStage._rangeQueryDepth; - glGetInteger64v(GL_TIMESTAMP, (GLint64*)&glquery->_batchElapsedTime); + glquery->_batchElapsedTimeBegin = std::chrono::high_resolution_clock::now(); + // glGetInteger64v(GL_TIMESTAMP, (GLint64*)&glquery->_batchElapsedTime); if (timeElapsed) { if (_queryStage._rangeQueryDepth <= MAX_RANGE_QUERY_DEPTH) { @@ -61,9 +62,10 @@ void GLBackend::do_endQuery(const Batch& batch, size_t paramOffset) { } --_queryStage._rangeQueryDepth; - GLint64 now; - glGetInteger64v(GL_TIMESTAMP, &now); - glquery->_batchElapsedTime = now - glquery->_batchElapsedTime; + // GLint64 now; + // glGetInteger64v(GL_TIMESTAMP, &now); + auto duration_ns = (std::chrono::high_resolution_clock::now() - glquery->_batchElapsedTimeBegin); + glquery->_batchElapsedTime = duration_ns.count(); PROFILE_RANGE_END(render_gpu_gl_detail, glquery->_profileRangeId); diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLQuery.h b/libraries/gpu-gl-common/src/gpu/gl/GLQuery.h index 23b1f38621..18d79d5896 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLQuery.h +++ b/libraries/gpu-gl-common/src/gpu/gl/GLQuery.h @@ -48,7 +48,8 @@ public: const GLuint& _endqo = { _id }; const GLuint _beginqo = { 0 }; GLuint64 _result { (GLuint64)-1 }; - GLuint64 _batchElapsedTime { (GLuint64) 0 }; + GLuint64 _batchElapsedTime{ (GLuint64)0 }; + std::chrono::high_resolution_clock::time_point _batchElapsedTimeBegin; uint64_t _profileRangeId { 0 }; uint32_t _rangeQueryDepth { 0 }; diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp index 6d17923ebd..d271f79b92 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendBuffer.cpp @@ -52,7 +52,7 @@ GLuint GL45Backend::getBufferID(const Buffer& buffer) { } GLuint GL45Backend::getBufferIDUnsynced(const Buffer& buffer) { - return GL45Buffer::getIdUnsynced(*this, buffer); + return GLBuffer::getIdUnsynced(*this, buffer); } GLBuffer* GL45Backend::syncGPUObject(const Buffer& buffer) {