summaryrefslogtreecommitdiffstats
path: root/tests/manual/rhi/triquadcube/triquadcube.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/rhi/triquadcube/triquadcube.cpp')
-rw-r--r--tests/manual/rhi/triquadcube/triquadcube.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/tests/manual/rhi/triquadcube/triquadcube.cpp b/tests/manual/rhi/triquadcube/triquadcube.cpp
index f89f0753af..2ef0d567db 100644
--- a/tests/manual/rhi/triquadcube/triquadcube.cpp
+++ b/tests/manual/rhi/triquadcube/triquadcube.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2018 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
// An example exercising more than a single feature. Enables profiling
// (resource logging to a file) and inserts debug markers and sets some
@@ -35,7 +35,6 @@ struct {
QSize lastOutputSize;
int frameCount = 0;
QFile profOut;
- QVarLengthArray<float, 64> gpuFrameTimes;
QElapsedTimer gpuFrameTimePrintTimer;
} d;
@@ -134,22 +133,10 @@ void Window::customInit()
qDebug("MaxVertexOutputs: %d", m_r->resourceLimit(QRhi::MaxVertexOutputs));
// With Vulkan at least we should see some details from the memory allocator.
- qDebug() << m_r->graphicsMemoryAllocationStatistics();
+ qDebug() << m_r->statistics();
- // Every two seconds try printing an average of the gpu frame times.
+ // Every two seconds try printing last known gpu frame time.
d.gpuFrameTimePrintTimer.start();
- m_r->addGpuFrameTimeCallback([](float elapsedMs) {
- d.gpuFrameTimes.append(elapsedMs);
- if (d.gpuFrameTimePrintTimer.elapsed() > 2000) {
- float at = 0.0f;
- for (float t : d.gpuFrameTimes)
- at += t;
- at /= d.gpuFrameTimes.count();
- qDebug() << "Average GPU frame time" << at;
- d.gpuFrameTimes.clear();
- d.gpuFrameTimePrintTimer.restart();
- }
- });
}
void Window::customRelease()
@@ -170,6 +157,11 @@ void Window::customRender()
const QSize outputSize = m_sc->currentPixelSize();
QRhiCommandBuffer *cb = m_sc->currentFrameCommandBuffer();
+ if (d.gpuFrameTimePrintTimer.elapsed() > 2000) {
+ qDebug() << "Last completed GPU frame time" << cb->lastCompletedGpuTime() << "seconds";
+ d.gpuFrameTimePrintTimer.restart();
+ }
+
if (outputSize != d.lastOutputSize) {
d.triRenderer.resize(outputSize);
if (!d.triangleOnly) {