From 7e59be619693631685a4ad25ec44f0497b385234 Mon Sep 17 00:00:00 2001 From: Niraj Venkat Date: Wed, 8 Jul 2015 10:00:58 -0700 Subject: [PATCH 1/8] First take oon the query for the gpu --- libraries/gpu/src/gpu/Batch.cpp | 17 ++++ libraries/gpu/src/gpu/Batch.h | 12 +++ libraries/gpu/src/gpu/Context.h | 9 ++ libraries/gpu/src/gpu/GLBackend.cpp | 4 +- libraries/gpu/src/gpu/GLBackend.h | 17 ++++ libraries/gpu/src/gpu/GLBackendOutput.cpp | 1 - libraries/gpu/src/gpu/GLBackendQuery.cpp | 93 +++++++++++++++++++ libraries/gpu/src/gpu/Query.cpp | 27 ++++++ libraries/gpu/src/gpu/Query.h | 45 +++++++++ .../render-utils/src/RenderDeferredTask.cpp | 24 +++++ .../render-utils/src/RenderDeferredTask.h | 3 + 11 files changed, 250 insertions(+), 2 deletions(-) create mode 100644 libraries/gpu/src/gpu/GLBackendQuery.cpp create mode 100644 libraries/gpu/src/gpu/Query.cpp create mode 100644 libraries/gpu/src/gpu/Query.h diff --git a/libraries/gpu/src/gpu/Batch.cpp b/libraries/gpu/src/gpu/Batch.cpp index ee028e79e6..c97c9603b6 100644 --- a/libraries/gpu/src/gpu/Batch.cpp +++ b/libraries/gpu/src/gpu/Batch.cpp @@ -213,3 +213,20 @@ void Batch::setFramebuffer(const FramebufferPointer& framebuffer) { } +void Batch::beginQuery(const QueryPointer& query) { + ADD_COMMAND(beginQuery); + + _params.push_back(_queries.cache(query)); +} + +void Batch::endQuery(const QueryPointer& query) { + ADD_COMMAND(endQuery); + + _params.push_back(_queries.cache(query)); +} + +void Batch::getQuery(const QueryPointer& query) { + ADD_COMMAND(getQuery); + + _params.push_back(_queries.cache(query)); +} diff --git a/libraries/gpu/src/gpu/Batch.h b/libraries/gpu/src/gpu/Batch.h index 835e872b4a..6b98ae7917 100644 --- a/libraries/gpu/src/gpu/Batch.h +++ b/libraries/gpu/src/gpu/Batch.h @@ -18,6 +18,7 @@ #include +#include "Query.h" #include "Stream.h" #include "Texture.h" @@ -121,6 +122,11 @@ public: // Framebuffer Stage void setFramebuffer(const FramebufferPointer& framebuffer); + // Query Section + void beginQuery(const QueryPointer& query); + void endQuery(const QueryPointer& query); + void getQuery(const QueryPointer& query); + // TODO: As long as we have gl calls explicitely issued from interface // code, we need to be able to record and batch these calls. THe long // term strategy is to get rid of any GL calls in favor of the HIFI GPU API @@ -189,6 +195,10 @@ public: COMMAND_setFramebuffer, + COMMAND_beginQuery, + COMMAND_endQuery, + COMMAND_getQuery, + // TODO: As long as we have gl calls explicitely issued from interface // code, we need to be able to record and batch these calls. THe long // term strategy is to get rid of any GL calls in favor of the HIFI GPU API @@ -292,6 +302,7 @@ public: typedef Cache::Vector TransformCaches; typedef Cache::Vector PipelineCaches; typedef Cache::Vector FramebufferCaches; + typedef Cache::Vector QueryCaches; // Cache Data in a byte array if too big to fit in Param // FOr example Mat4s are going there @@ -316,6 +327,7 @@ public: TransformCaches _transforms; PipelineCaches _pipelines; FramebufferCaches _framebuffers; + QueryCaches _queries; protected: }; diff --git a/libraries/gpu/src/gpu/Context.h b/libraries/gpu/src/gpu/Context.h index 98ddc7fb64..d34954f50c 100644 --- a/libraries/gpu/src/gpu/Context.h +++ b/libraries/gpu/src/gpu/Context.h @@ -99,6 +99,15 @@ public: return reinterpret_cast(framebuffer.getGPUObject()); } + template< typename T > + static void setGPUObject(const Query& query, T* object) { + query.setGPUObject(object); + } + template< typename T > + static T* getGPUObject(const Query& query) { + return reinterpret_cast(query.getGPUObject()); + } + protected: }; diff --git a/libraries/gpu/src/gpu/GLBackend.cpp b/libraries/gpu/src/gpu/GLBackend.cpp index 302dc0e8be..63b48cab31 100644 --- a/libraries/gpu/src/gpu/GLBackend.cpp +++ b/libraries/gpu/src/gpu/GLBackend.cpp @@ -39,6 +39,9 @@ GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] = (&::gpu::GLBackend::do_setFramebuffer), + (&::gpu::GLBackend::do_beginQuery), + (&::gpu::GLBackend::do_endQuery), + (&::gpu::GLBackend::do_getQuery), (&::gpu::GLBackend::do_glEnable), (&::gpu::GLBackend::do_glDisable), @@ -243,7 +246,6 @@ void GLBackend::do_clearFramebuffer(Batch& batch, uint32 paramOffset) { (void) CHECK_GL_ERROR(); } - // TODO: As long as we have gl calls explicitely issued from interface // code, we need to be able to record and batch these calls. THe long // term strategy is to get rid of any GL calls in favor of the HIFI GPU API diff --git a/libraries/gpu/src/gpu/GLBackend.h b/libraries/gpu/src/gpu/GLBackend.h index d798e9aaac..6313e8e7ac 100644 --- a/libraries/gpu/src/gpu/GLBackend.h +++ b/libraries/gpu/src/gpu/GLBackend.h @@ -188,6 +188,18 @@ public: static GLFramebuffer* syncGPUObject(const Framebuffer& framebuffer); static GLuint getFramebufferID(const FramebufferPointer& framebuffer); + class GLQuery : public GPUObject { + public: + GLuint _qo = 0; + GLuint64 _result = 0; + + GLQuery(); + ~GLQuery(); + }; + static GLQuery* syncGPUObject(const Query& query); + static GLuint getQueryID(const QueryPointer& query); + + static const int MAX_NUM_ATTRIBUTES = Stream::NUM_INPUT_SLOTS; static const int MAX_NUM_INPUT_BUFFERS = 16; @@ -367,6 +379,11 @@ protected: OutputStageState() {} } _output; + // Query section + void do_beginQuery(Batch& batch, uint32 paramOffset); + void do_endQuery(Batch& batch, uint32 paramOffset); + void do_getQuery(Batch& batch, uint32 paramOffset); + // TODO: As long as we have gl calls explicitely issued from interface // code, we need to be able to record and batch these calls. THe long // term strategy is to get rid of any GL calls in favor of the HIFI GPU API diff --git a/libraries/gpu/src/gpu/GLBackendOutput.cpp b/libraries/gpu/src/gpu/GLBackendOutput.cpp index 903c97f45b..ef0f7c7f34 100755 --- a/libraries/gpu/src/gpu/GLBackendOutput.cpp +++ b/libraries/gpu/src/gpu/GLBackendOutput.cpp @@ -167,4 +167,3 @@ void GLBackend::do_setFramebuffer(Batch& batch, uint32 paramOffset) { _output._framebuffer = framebuffer; } } - diff --git a/libraries/gpu/src/gpu/GLBackendQuery.cpp b/libraries/gpu/src/gpu/GLBackendQuery.cpp new file mode 100644 index 0000000000..2bc6a7896c --- /dev/null +++ b/libraries/gpu/src/gpu/GLBackendQuery.cpp @@ -0,0 +1,93 @@ +// +// GLBackendQuery.cpp +// libraries/gpu/src/gpu +// +// Created by Sam Gateau on 7/7/2015. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#include "GPULogging.h" +#include "GLBackendShared.h" + +using namespace gpu; + +GLBackend::GLQuery::GLQuery() {} + +GLBackend::GLQuery::~GLQuery() { + if (_qo != 0) { + glDeleteQueries(1, &_qo); + } +} + +GLBackend::GLQuery* GLBackend::syncGPUObject(const Query& query) { + GLQuery* object = Backend::getGPUObject(query); + + // If GPU object already created and in sync + if (object) { + return object; + } + + // need to have a gpu object? + if (!object) { + GLuint qo; + glGenQueries(1, &qo); + (void) CHECK_GL_ERROR(); + GLuint64 result = -1; + + // All is green, assign the gpuobject to the Query + object = new GLQuery(); + object->_qo = qo; + object->_result = result; + Backend::setGPUObject(query, object); + } + + return object; +} + + + +GLuint GLBackend::getQueryID(const QueryPointer& query) { + if (!query) { + return 0; + } + GLQuery* object = GLBackend::syncGPUObject(*query); + if (object) { + return object->_qo; + } else { + return 0; + } +} + +void GLBackend::do_beginQuery(Batch& batch, uint32 paramOffset) { + auto& query = batch._queries.get(batch._params[paramOffset]._uint); + GLQuery* glquery = syncGPUObject(*query); + if (glquery) { + glBeginQuery(GL_TIME_ELAPSED, glquery->_qo); + (void)CHECK_GL_ERROR(); + } +} + +void GLBackend::do_endQuery(Batch& batch, uint32 paramOffset) { + auto& query = batch._queries.get(batch._params[paramOffset]._uint); + GLQuery* glquery = syncGPUObject(*query); + if (glquery) { + glEndQuery(GL_TIME_ELAPSED); + (void)CHECK_GL_ERROR(); + } +} + +void GLBackend::do_getQuery(Batch& batch, uint32 paramOffset) { + auto& query = batch._queries.get(batch._params[paramOffset]._uint); + GLQuery* glquery = syncGPUObject(*query); + if (glquery) { + GLint available = 0; + while (!available) { + glGetQueryObjectiv(glquery->_qo, GL_QUERY_RESULT_AVAILABLE, &available); + } + + glGetQueryObjectui64v(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); + (void)CHECK_GL_ERROR(); + } +} diff --git a/libraries/gpu/src/gpu/Query.cpp b/libraries/gpu/src/gpu/Query.cpp new file mode 100644 index 0000000000..b8ed729c99 --- /dev/null +++ b/libraries/gpu/src/gpu/Query.cpp @@ -0,0 +1,27 @@ +// +// Query.cpp +// interface/src/gpu +// +// Created by Niraj Venkat on 7/7/2015. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#include "Query.h" + +#include + +using namespace gpu; + +Query::Query() +{ +} + +Query::~Query() +{ +} + +double Query::getElapsedTime() { + return 0.0; +} diff --git a/libraries/gpu/src/gpu/Query.h b/libraries/gpu/src/gpu/Query.h new file mode 100644 index 0000000000..0a4d554e77 --- /dev/null +++ b/libraries/gpu/src/gpu/Query.h @@ -0,0 +1,45 @@ +// +// Query.h +// interface/src/gpu +// +// Created by Niraj Venkat on 7/7/2015. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#ifndef hifi_gpu_Query_h +#define hifi_gpu_Query_h + +#include +#include +#include +#include "GPUConfig.h" + +#include "Format.h" + +namespace gpu { + + class Query { + public: + Query(); + ~Query(); + + uint32 queryResult; + + double getElapsedTime(); + + protected: + + // This shouldn't be used by anything else than the Backend class with the proper casting. + mutable GPUObject* _gpuObject = NULL; + void setGPUObject(GPUObject* gpuObject) const { _gpuObject = gpuObject; } + GPUObject* getGPUObject() const { return _gpuObject; } + friend class Backend; + }; + + typedef std::shared_ptr QueryPointer; + typedef std::vector< QueryPointer > Queries; +}; + +#endif diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 12a6d32ae5..56980058c8 100755 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -75,6 +75,12 @@ RenderDeferredTask::RenderDeferredTask() : Task() { _jobs.push_back(Job(new DrawOverlay3D::JobModel("DrawOverlay3D"))); _jobs.push_back(Job(new ResetGLState::JobModel())); + + // Give ourselves 3 frmaes of timer queries + _timerQueries.push_back(gpu::QueryPointer(new gpu::Query())); + _timerQueries.push_back(gpu::QueryPointer(new gpu::Query())); + _timerQueries.push_back(gpu::QueryPointer(new gpu::Query())); + _currentTimerQueryIndex = 0; } RenderDeferredTask::~RenderDeferredTask() { @@ -98,9 +104,27 @@ void RenderDeferredTask::run(const SceneContextPointer& sceneContext, const Rend renderContext->args->_context->syncCache(); + // start the current timer query + auto& currentQuery = _timerQueries[_currentTimerQueryIndex]; + { + gpu::Batch batch; + batch.beginQuery(currentQuery); + renderContext->args->_context->render(batch); + } + for (auto job : _jobs) { job.run(sceneContext, renderContext); } + + // End the current timer query + { + gpu::Batch batch; + batch.endQuery(currentQuery); + batch.getQuery(currentQuery); + renderContext->args->_context->render(batch); + (_currentTimerQueryIndex++); + _currentTimerQueryIndex = _currentTimerQueryIndex% _timerQueries.size(); + } }; void DrawOpaqueDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems) { diff --git a/libraries/render-utils/src/RenderDeferredTask.h b/libraries/render-utils/src/RenderDeferredTask.h index 3d11e97634..4040606c62 100755 --- a/libraries/render-utils/src/RenderDeferredTask.h +++ b/libraries/render-utils/src/RenderDeferredTask.h @@ -77,6 +77,9 @@ public: virtual void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext); + + gpu::Queries _timerQueries; + int _currentTimerQueryIndex = 0; }; From a6ec668b2e5b116eaa0e82dbe5375ee141817a70 Mon Sep 17 00:00:00 2001 From: Niraj Venkat Date: Wed, 8 Jul 2015 14:24:24 -0700 Subject: [PATCH 2/8] attempt #1 to fix jenkins build error --- libraries/gpu/src/gpu/GLBackendQuery.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libraries/gpu/src/gpu/GLBackendQuery.cpp b/libraries/gpu/src/gpu/GLBackendQuery.cpp index 2bc6a7896c..6e448871c4 100644 --- a/libraries/gpu/src/gpu/GLBackendQuery.cpp +++ b/libraries/gpu/src/gpu/GLBackendQuery.cpp @@ -61,7 +61,7 @@ GLuint GLBackend::getQueryID(const QueryPointer& query) { } void GLBackend::do_beginQuery(Batch& batch, uint32 paramOffset) { - auto& query = batch._queries.get(batch._params[paramOffset]._uint); + auto query = batch._queries.get(batch._params[paramOffset]._uint); GLQuery* glquery = syncGPUObject(*query); if (glquery) { glBeginQuery(GL_TIME_ELAPSED, glquery->_qo); @@ -70,7 +70,7 @@ void GLBackend::do_beginQuery(Batch& batch, uint32 paramOffset) { } void GLBackend::do_endQuery(Batch& batch, uint32 paramOffset) { - auto& query = batch._queries.get(batch._params[paramOffset]._uint); + auto query = batch._queries.get(batch._params[paramOffset]._uint); GLQuery* glquery = syncGPUObject(*query); if (glquery) { glEndQuery(GL_TIME_ELAPSED); @@ -79,14 +79,9 @@ void GLBackend::do_endQuery(Batch& batch, uint32 paramOffset) { } void GLBackend::do_getQuery(Batch& batch, uint32 paramOffset) { - auto& query = batch._queries.get(batch._params[paramOffset]._uint); + auto query = batch._queries.get(batch._params[paramOffset]._uint); GLQuery* glquery = syncGPUObject(*query); - if (glquery) { - GLint available = 0; - while (!available) { - glGetQueryObjectiv(glquery->_qo, GL_QUERY_RESULT_AVAILABLE, &available); - } - + if (glquery) { glGetQueryObjectui64v(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); (void)CHECK_GL_ERROR(); } From 250d2e9e2c061916b5554729febc827eaea3e51a Mon Sep 17 00:00:00 2001 From: Niraj Venkat Date: Wed, 8 Jul 2015 15:14:28 -0700 Subject: [PATCH 3/8] attempt #2 to fix jenkins build error --- libraries/gpu/src/gpu/GLBackend.h | 2 +- libraries/gpu/src/gpu/GLBackendQuery.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/gpu/src/gpu/GLBackend.h b/libraries/gpu/src/gpu/GLBackend.h index 6313e8e7ac..b142e63e65 100644 --- a/libraries/gpu/src/gpu/GLBackend.h +++ b/libraries/gpu/src/gpu/GLBackend.h @@ -191,7 +191,7 @@ public: class GLQuery : public GPUObject { public: GLuint _qo = 0; - GLuint64 _result = 0; + GLuint _result = 0; GLQuery(); ~GLQuery(); diff --git a/libraries/gpu/src/gpu/GLBackendQuery.cpp b/libraries/gpu/src/gpu/GLBackendQuery.cpp index 6e448871c4..bcd291f7e7 100644 --- a/libraries/gpu/src/gpu/GLBackendQuery.cpp +++ b/libraries/gpu/src/gpu/GLBackendQuery.cpp @@ -82,7 +82,7 @@ void GLBackend::do_getQuery(Batch& batch, uint32 paramOffset) { auto query = batch._queries.get(batch._params[paramOffset]._uint); GLQuery* glquery = syncGPUObject(*query); if (glquery) { - glGetQueryObjectui64v(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); + glGetQueryObjectuiv(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); (void)CHECK_GL_ERROR(); } } From 4478d76618efb2b7ada6a2444e4990490639c754 Mon Sep 17 00:00:00 2001 From: Niraj Venkat Date: Wed, 8 Jul 2015 15:28:25 -0700 Subject: [PATCH 4/8] attempt #3 - fixing ubuntu build --- libraries/gpu/src/gpu/GLBackendQuery.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/gpu/src/gpu/GLBackendQuery.cpp b/libraries/gpu/src/gpu/GLBackendQuery.cpp index bcd291f7e7..a6e34a90ca 100644 --- a/libraries/gpu/src/gpu/GLBackendQuery.cpp +++ b/libraries/gpu/src/gpu/GLBackendQuery.cpp @@ -11,6 +11,11 @@ #include "GPULogging.h" #include "GLBackendShared.h" +#ifndef GL_ARB_timer_query +#define GL_TIME_ELAPSED 0x88BF +#define GL_TIMESTAMP 0x8E28 +#endif + using namespace gpu; GLBackend::GLQuery::GLQuery() {} From 1894b42773745e8f46e142aef3ee397f82cd034d Mon Sep 17 00:00:00 2001 From: Niraj Venkat Date: Wed, 8 Jul 2015 16:11:36 -0700 Subject: [PATCH 5/8] Added EXT support for Mac GL Query calls --- libraries/gpu/src/gpu/GLBackendQuery.cpp | 24 ++++++++++++++----- .../render-utils/src/RenderDeferredTask.cpp | 17 ------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/libraries/gpu/src/gpu/GLBackendQuery.cpp b/libraries/gpu/src/gpu/GLBackendQuery.cpp index a6e34a90ca..585d7de5ff 100644 --- a/libraries/gpu/src/gpu/GLBackendQuery.cpp +++ b/libraries/gpu/src/gpu/GLBackendQuery.cpp @@ -11,10 +11,6 @@ #include "GPULogging.h" #include "GLBackendShared.h" -#ifndef GL_ARB_timer_query -#define GL_TIME_ELAPSED 0x88BF -#define GL_TIMESTAMP 0x8E28 -#endif using namespace gpu; @@ -70,6 +66,12 @@ void GLBackend::do_beginQuery(Batch& batch, uint32 paramOffset) { GLQuery* glquery = syncGPUObject(*query); if (glquery) { glBeginQuery(GL_TIME_ELAPSED, glquery->_qo); + #if (GPU_FEATURE_PROFILE == GPU_LEGACY) + // (EXT_TIMER_QUERY) + glBeginQuery(TIME_ELAPSED_EXT, glquery->_qo); + #else + glBeginQuery(GL_TIME_ELAPSED, glquery->_qo); + #endif (void)CHECK_GL_ERROR(); } } @@ -78,7 +80,12 @@ void GLBackend::do_endQuery(Batch& batch, uint32 paramOffset) { auto query = batch._queries.get(batch._params[paramOffset]._uint); GLQuery* glquery = syncGPUObject(*query); if (glquery) { - glEndQuery(GL_TIME_ELAPSED); + #if (GPU_FEATURE_PROFILE == GPU_LEGACY) + // (EXT_TIMER_QUERY) + glEndQuery(TIME_ELAPSED_EXT); + #else + glEndQuery(GL_TIME_ELAPSED); + #endif (void)CHECK_GL_ERROR(); } } @@ -87,7 +94,12 @@ void GLBackend::do_getQuery(Batch& batch, uint32 paramOffset) { auto query = batch._queries.get(batch._params[paramOffset]._uint); GLQuery* glquery = syncGPUObject(*query); if (glquery) { - glGetQueryObjectuiv(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); + #if (GPU_FEATURE_PROFILE == GPU_LEGACY) + // (EXT_TIMER_QUERY) + GetQueryObjectui64vEXT(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); + #else + glGetQueryObjectui64v(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); + #endif (void)CHECK_GL_ERROR(); } } diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 56980058c8..9ae0bd1b36 100755 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -104,27 +104,10 @@ void RenderDeferredTask::run(const SceneContextPointer& sceneContext, const Rend renderContext->args->_context->syncCache(); - // start the current timer query - auto& currentQuery = _timerQueries[_currentTimerQueryIndex]; - { - gpu::Batch batch; - batch.beginQuery(currentQuery); - renderContext->args->_context->render(batch); - } - for (auto job : _jobs) { job.run(sceneContext, renderContext); } - // End the current timer query - { - gpu::Batch batch; - batch.endQuery(currentQuery); - batch.getQuery(currentQuery); - renderContext->args->_context->render(batch); - (_currentTimerQueryIndex++); - _currentTimerQueryIndex = _currentTimerQueryIndex% _timerQueries.size(); - } }; void DrawOpaqueDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems) { From 58f127f29946f0ad0940219f0f2ba66842183973 Mon Sep 17 00:00:00 2001 From: Niraj Venkat Date: Wed, 8 Jul 2015 17:17:31 -0700 Subject: [PATCH 6/8] Fixing names of GL enums --- libraries/gpu/src/gpu/GLBackend.h | 2 +- libraries/gpu/src/gpu/GLBackendQuery.cpp | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libraries/gpu/src/gpu/GLBackend.h b/libraries/gpu/src/gpu/GLBackend.h index b142e63e65..6313e8e7ac 100644 --- a/libraries/gpu/src/gpu/GLBackend.h +++ b/libraries/gpu/src/gpu/GLBackend.h @@ -191,7 +191,7 @@ public: class GLQuery : public GPUObject { public: GLuint _qo = 0; - GLuint _result = 0; + GLuint64 _result = 0; GLQuery(); ~GLQuery(); diff --git a/libraries/gpu/src/gpu/GLBackendQuery.cpp b/libraries/gpu/src/gpu/GLBackendQuery.cpp index 585d7de5ff..003f757450 100644 --- a/libraries/gpu/src/gpu/GLBackendQuery.cpp +++ b/libraries/gpu/src/gpu/GLBackendQuery.cpp @@ -65,10 +65,9 @@ void GLBackend::do_beginQuery(Batch& batch, uint32 paramOffset) { auto query = batch._queries.get(batch._params[paramOffset]._uint); GLQuery* glquery = syncGPUObject(*query); if (glquery) { - glBeginQuery(GL_TIME_ELAPSED, glquery->_qo); #if (GPU_FEATURE_PROFILE == GPU_LEGACY) // (EXT_TIMER_QUERY) - glBeginQuery(TIME_ELAPSED_EXT, glquery->_qo); + glBeginQuery(GL_TIME_ELAPSED_EXT, glquery->_qo); #else glBeginQuery(GL_TIME_ELAPSED, glquery->_qo); #endif @@ -82,7 +81,7 @@ void GLBackend::do_endQuery(Batch& batch, uint32 paramOffset) { if (glquery) { #if (GPU_FEATURE_PROFILE == GPU_LEGACY) // (EXT_TIMER_QUERY) - glEndQuery(TIME_ELAPSED_EXT); + glEndQuery(GL_TIME_ELAPSED_EXT); #else glEndQuery(GL_TIME_ELAPSED); #endif @@ -96,7 +95,7 @@ void GLBackend::do_getQuery(Batch& batch, uint32 paramOffset) { if (glquery) { #if (GPU_FEATURE_PROFILE == GPU_LEGACY) // (EXT_TIMER_QUERY) - GetQueryObjectui64vEXT(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); + glGetQueryObjectui64vEXT(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); #else glGetQueryObjectui64v(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); #endif From 2e5fd04d9e121cb5256d84e7d446169668c34a0b Mon Sep 17 00:00:00 2001 From: Niraj Venkat Date: Fri, 10 Jul 2015 11:27:34 -0700 Subject: [PATCH 7/8] Fix to get build working on Linux --- libraries/gpu/src/gpu/GLBackendQuery.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/gpu/src/gpu/GLBackendQuery.cpp b/libraries/gpu/src/gpu/GLBackendQuery.cpp index 003f757450..39db19dafd 100644 --- a/libraries/gpu/src/gpu/GLBackendQuery.cpp +++ b/libraries/gpu/src/gpu/GLBackendQuery.cpp @@ -95,7 +95,9 @@ void GLBackend::do_getQuery(Batch& batch, uint32 paramOffset) { if (glquery) { #if (GPU_FEATURE_PROFILE == GPU_LEGACY) // (EXT_TIMER_QUERY) + #if !defined(Q_OS_LINUX) glGetQueryObjectui64vEXT(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); + #endif #else glGetQueryObjectui64v(glquery->_qo, GL_QUERY_RESULT, &glquery->_result); #endif From 1dd40af16242e4343dba5a728e5d7a3b7917415e Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 10 Jul 2015 12:43:35 -0700 Subject: [PATCH 8/8] fix AnimationLoop::setRunning() to not constantly reset the frame when the running state doesn't actually change --- libraries/animation/src/AnimationLoop.cpp | 10 +++++----- libraries/entities/src/EntityItemProperties.cpp | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libraries/animation/src/AnimationLoop.cpp b/libraries/animation/src/AnimationLoop.cpp index e60df1eaf9..43e049f851 100644 --- a/libraries/animation/src/AnimationLoop.cpp +++ b/libraries/animation/src/AnimationLoop.cpp @@ -84,14 +84,14 @@ void AnimationLoop::setStartAutomatically(bool startAutomatically) { } void AnimationLoop::setRunning(bool running) { - if (_running == running) { + // don't do anything if the new value is the same as the value we already have + if (_running != running) { + _running = running; + + // If we just set running to true, then also reset the frame to the first frame if (running) { // move back to the beginning _frameIndex = _firstFrame; } - return; - } - if ((_running = running)) { - _frameIndex = _firstFrame; } } diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 9a1a5494b7..106e0a6b8b 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -128,6 +128,10 @@ void EntityItemProperties::setSittingPoints(const QVector& sitting } } +bool EntityItemProperties::animationSettingsChanged() const { + return _animationSettingsChanged; +} + void EntityItemProperties::setAnimationSettings(const QString& value) { // the animations setting is a JSON string that may contain various animation settings. // if it includes fps, frameIndex, or running, those values will be parsed out and