mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
Adding the frame gpu and batch timer
This commit is contained in:
parent
3db1831841
commit
76aa541d4a
5 changed files with 46 additions and 2 deletions
|
@ -189,6 +189,15 @@ Item {
|
||||||
Column {
|
Column {
|
||||||
id: octreeCol
|
id: octreeCol
|
||||||
spacing: 4; x: 4; y: 4;
|
spacing: 4; x: 4; y: 4;
|
||||||
|
StatText {
|
||||||
|
text: " Frame timing:"
|
||||||
|
}
|
||||||
|
StatText {
|
||||||
|
text: " Batch: " + root.batchFrameTime.toFixed(1) + " ms"
|
||||||
|
}
|
||||||
|
StatText {
|
||||||
|
text: " GPU: " + root.gpuFrameTime.toFixed(1) + " ms"
|
||||||
|
}
|
||||||
StatText {
|
StatText {
|
||||||
text: "Triangles: " + root.triangles +
|
text: "Triangles: " + root.triangles +
|
||||||
" / Material Switches: " + root.materialSwitches
|
" / Material Switches: " + root.materialSwitches
|
||||||
|
|
|
@ -1240,7 +1240,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
properties["gl_info"] = glInfo;
|
properties["gl_info"] = glInfo;
|
||||||
properties["gpu_used_memory"] = (int)BYTES_TO_MB(gpu::Context::getUsedGPUMemory());
|
properties["gpu_used_memory"] = (int)BYTES_TO_MB(gpu::Context::getUsedGPUMemory());
|
||||||
properties["gpu_free_memory"] = (int)BYTES_TO_MB(gpu::Context::getFreeGPUMemory());
|
properties["gpu_free_memory"] = (int)BYTES_TO_MB(gpu::Context::getFreeGPUMemory());
|
||||||
properties["gpu_frame_time"] = (int)(qApp->getRenderEngine()->);
|
properties["gpu_frame_time"] = (float)(qApp->getGPUContext()->getFrameTimerGPUAverage());
|
||||||
|
properties["batch_frame_time"] = (float)(qApp->getGPUContext()->getFrameTimerBatchAverage());
|
||||||
properties["ideal_thread_count"] = QThread::idealThreadCount();
|
properties["ideal_thread_count"] = QThread::idealThreadCount();
|
||||||
|
|
||||||
auto hmdHeadPose = getHMDSensorPose();
|
auto hmdHeadPose = getHMDSensorPose();
|
||||||
|
|
|
@ -290,6 +290,12 @@ void Stats::updateStats(bool force) {
|
||||||
STAT_UPDATE(sendingMode, sendingModeResult);
|
STAT_UPDATE(sendingMode, sendingModeResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto& GPUContext = qApp->getGPUContext();
|
||||||
|
|
||||||
|
// Update Frame timing (in ms)
|
||||||
|
STAT_UPDATE(gpuFrameTime, (float) GPUContext->getFrameTimerGPUAverage());
|
||||||
|
STAT_UPDATE(batchFrameTime, (float)GPUContext->getFrameTimerBatchAverage());
|
||||||
|
|
||||||
STAT_UPDATE(gpuBuffers, (int)gpu::Context::getBufferGPUCount());
|
STAT_UPDATE(gpuBuffers, (int)gpu::Context::getBufferGPUCount());
|
||||||
STAT_UPDATE(gpuBufferMemory, (int)BYTES_TO_MB(gpu::Context::getBufferGPUMemoryUsage()));
|
STAT_UPDATE(gpuBufferMemory, (int)BYTES_TO_MB(gpu::Context::getBufferGPUMemoryUsage()));
|
||||||
STAT_UPDATE(gpuTextures, (int)gpu::Context::getTextureGPUCount());
|
STAT_UPDATE(gpuTextures, (int)gpu::Context::getTextureGPUCount());
|
||||||
|
|
|
@ -101,6 +101,8 @@ class Stats : public QQuickItem {
|
||||||
STATS_PROPERTY(int, gpuTextureSparseMemory, 0)
|
STATS_PROPERTY(int, gpuTextureSparseMemory, 0)
|
||||||
STATS_PROPERTY(int, gpuSparseTextureEnabled, 0)
|
STATS_PROPERTY(int, gpuSparseTextureEnabled, 0)
|
||||||
STATS_PROPERTY(int, gpuFreeMemory, 0)
|
STATS_PROPERTY(int, gpuFreeMemory, 0)
|
||||||
|
STATS_PROPERTY(float, gpuFrameTime, 0)
|
||||||
|
STATS_PROPERTY(float, batchFrameTime, 0)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Stats* getInstance();
|
static Stats* getInstance();
|
||||||
|
@ -198,6 +200,8 @@ signals:
|
||||||
void gpuTextureSparseMemoryChanged();
|
void gpuTextureSparseMemoryChanged();
|
||||||
void gpuSparseTextureEnabledChanged();
|
void gpuSparseTextureEnabledChanged();
|
||||||
void gpuFreeMemoryChanged();
|
void gpuFreeMemoryChanged();
|
||||||
|
void gpuFrameTimeChanged();
|
||||||
|
void batchFrameTimeChanged();
|
||||||
void rectifiedTextureCountChanged();
|
void rectifiedTextureCountChanged();
|
||||||
void decimatedTextureCountChanged();
|
void decimatedTextureCountChanged();
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ void Context::beginFrame(const glm::mat4& renderPose) {
|
||||||
_currentFrame->pose = renderPose;
|
_currentFrame->pose = renderPose;
|
||||||
|
|
||||||
if (!_frameRangeTimer) {
|
if (!_frameRangeTimer) {
|
||||||
_frameRangeTimer = std::make_shared<RangeTimer>("gpu::Frame");
|
_frameRangeTimer = std::make_shared<RangeTimer>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,10 +77,18 @@ void Context::executeFrame(const FramePointer& frame) const {
|
||||||
consumeFrameUpdates(frame);
|
consumeFrameUpdates(frame);
|
||||||
_backend->setStereoState(frame->stereoState);
|
_backend->setStereoState(frame->stereoState);
|
||||||
{
|
{
|
||||||
|
Batch beginBatch;
|
||||||
|
_frameRangeTimer->begin(beginBatch);
|
||||||
|
_backend->render(beginBatch);
|
||||||
|
|
||||||
// Execute the frame rendering commands
|
// Execute the frame rendering commands
|
||||||
for (auto& batch : frame->batches) {
|
for (auto& batch : frame->batches) {
|
||||||
_backend->render(batch);
|
_backend->render(batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Batch endBatch;
|
||||||
|
_frameRangeTimer->end(endBatch);
|
||||||
|
_backend->render(endBatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,6 +139,20 @@ void Context::getStats(ContextStats& stats) const {
|
||||||
_backend->getStats(stats);
|
_backend->getStats(stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double Context::getFrameTimerGPUAverage() const {
|
||||||
|
if (_frameRangeTimer) {
|
||||||
|
return _frameRangeTimer->getGPUAverage();
|
||||||
|
}
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Context::getFrameTimerBatchAverage() const {
|
||||||
|
if (_frameRangeTimer) {
|
||||||
|
return _frameRangeTimer->getBatchAverage();
|
||||||
|
}
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
const Backend::TransformCamera& Backend::TransformCamera::recomputeDerived(const Transform& xformView) const {
|
const Backend::TransformCamera& Backend::TransformCamera::recomputeDerived(const Transform& xformView) const {
|
||||||
_projectionInverse = glm::inverse(_projection);
|
_projectionInverse = glm::inverse(_projection);
|
||||||
|
|
||||||
|
@ -357,3 +379,5 @@ void Backend::updateTextureGPUFramebufferMemoryUsage(Resource::Size prevObjectSi
|
||||||
void Backend::updateTextureGPUSparseMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize) { Context::updateTextureGPUSparseMemoryUsage(prevObjectSize, newObjectSize); }
|
void Backend::updateTextureGPUSparseMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize) { Context::updateTextureGPUSparseMemoryUsage(prevObjectSize, newObjectSize); }
|
||||||
void Backend::incrementTextureGPUTransferCount() { Context::incrementTextureGPUTransferCount(); }
|
void Backend::incrementTextureGPUTransferCount() { Context::incrementTextureGPUTransferCount(); }
|
||||||
void Backend::decrementTextureGPUTransferCount() { Context::decrementTextureGPUTransferCount(); }
|
void Backend::decrementTextureGPUTransferCount() { Context::decrementTextureGPUTransferCount(); }
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue