Added per pixel GPU stats

This commit is contained in:
Sam 2018-07-04 17:15:12 +02:00
parent c840670a54
commit 58f004352a
3 changed files with 29 additions and 1 deletions

View file

@ -263,6 +263,12 @@ Item {
}
StatText {
text: "GPU: " + root.gpuFrameTime.toFixed(1) + " ms"
}
StatText {
text: "GPU (Per pixel): " + root.gpuFrameTimePerPixel.toFixed(5) + " ns/pp"
}
StatText {
text: "GPU frame size: " + root.gpuFrameSize.x + " x " + root.gpuFrameSize.y
}
StatText {
text: "Triangles: " + root.triangles +

View file

@ -333,7 +333,13 @@ void Stats::updateStats(bool force) {
}
auto gpuContext = qApp->getGPUContext();
auto displayPlugin = qApp->getActiveDisplayPlugin();
if (displayPlugin) {
QVector2D dims(displayPlugin->getRecommendedRenderSize().x, displayPlugin->getRecommendedRenderSize().y);
dims *= displayPlugin->getRenderResolutionScale();
STAT_UPDATE(gpuFrameSize, dims);
STAT_UPDATE(gpuFrameTimePerPixel, (float)(gpuContext->getFrameTimerGPUAverage()*1000000.0 / double(dims.x()*dims.y())));
}
// Update Frame timing (in ms)
STAT_UPDATE(gpuFrameTime, (float)gpuContext->getFrameTimerGPUAverage());
STAT_UPDATE(batchFrameTime, (float)gpuContext->getFrameTimerBatchAverage());

View file

@ -276,7 +276,9 @@ class Stats : public QQuickItem {
STATS_PROPERTY(int, gpuTextureExternalMemory, 0)
STATS_PROPERTY(QString, gpuTextureMemoryPressureState, QString())
STATS_PROPERTY(int, gpuFreeMemory, 0)
STATS_PROPERTY(QVector2D, gpuFrameSize, QVector2D(0,0))
STATS_PROPERTY(float, gpuFrameTime, 0)
STATS_PROPERTY(float, gpuFrameTimePerPixel, 0)
STATS_PROPERTY(float, batchFrameTime, 0)
STATS_PROPERTY(float, engineFrameTime, 0)
STATS_PROPERTY(float, avatarSimulationTime, 0)
@ -962,6 +964,20 @@ signals:
*/
void gpuFrameTimeChanged();
/**jsdoc
* Triggered when the value of the <code>gpuFrameTime</code> property changes.
* @function Stats.gpuFrameTimeChanged
* @returns {Signal}
*/
void gpuFrameSizeChanged();
/**jsdoc
* Triggered when the value of the <code>gpuFrameTime</code> property changes.
* @function Stats.gpuFrameTimeChanged
* @returns {Signal}
*/
void gpuFrameTimePerPixelChanged();
/**jsdoc
* Triggered when the value of the <code>batchFrameTime</code> property changes.
* @function Stats.batchFrameTimeChanged