mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Added EXT support for Mac GL Query calls
This commit is contained in:
parent
4478d76618
commit
1894b42773
2 changed files with 18 additions and 23 deletions
|
@ -11,10 +11,6 @@
|
||||||
#include "GPULogging.h"
|
#include "GPULogging.h"
|
||||||
#include "GLBackendShared.h"
|
#include "GLBackendShared.h"
|
||||||
|
|
||||||
#ifndef GL_ARB_timer_query
|
|
||||||
#define GL_TIME_ELAPSED 0x88BF
|
|
||||||
#define GL_TIMESTAMP 0x8E28
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace gpu;
|
using namespace gpu;
|
||||||
|
|
||||||
|
@ -70,6 +66,12 @@ void GLBackend::do_beginQuery(Batch& batch, uint32 paramOffset) {
|
||||||
GLQuery* glquery = syncGPUObject(*query);
|
GLQuery* glquery = syncGPUObject(*query);
|
||||||
if (glquery) {
|
if (glquery) {
|
||||||
glBeginQuery(GL_TIME_ELAPSED, glquery->_qo);
|
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();
|
(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);
|
auto query = batch._queries.get(batch._params[paramOffset]._uint);
|
||||||
GLQuery* glquery = syncGPUObject(*query);
|
GLQuery* glquery = syncGPUObject(*query);
|
||||||
if (glquery) {
|
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();
|
(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);
|
auto query = batch._queries.get(batch._params[paramOffset]._uint);
|
||||||
GLQuery* glquery = syncGPUObject(*query);
|
GLQuery* glquery = syncGPUObject(*query);
|
||||||
if (glquery) {
|
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();
|
(void)CHECK_GL_ERROR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,27 +104,10 @@ void RenderDeferredTask::run(const SceneContextPointer& sceneContext, const Rend
|
||||||
|
|
||||||
renderContext->args->_context->syncCache();
|
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) {
|
for (auto job : _jobs) {
|
||||||
job.run(sceneContext, renderContext);
|
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) {
|
void DrawOpaqueDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems) {
|
||||||
|
|
Loading…
Reference in a new issue