From d746fba142d271aed425c61a5b9ac98a82363fe9 Mon Sep 17 00:00:00 2001 From: samcake Date: Mon, 18 Apr 2016 11:18:28 -0700 Subject: [PATCH] Cleaning up the stats.qml --- examples/utilities/render/stats.qml | 29 +++++++++++++-------- libraries/gpu/src/gpu/Context.h | 2 ++ libraries/gpu/src/gpu/GLBackendPipeline.cpp | 3 +++ libraries/render/src/render/EngineStats.cpp | 2 ++ libraries/render/src/render/EngineStats.h | 7 +++++ 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/examples/utilities/render/stats.qml b/examples/utilities/render/stats.qml index e6cd03b3c3..72df7db91c 100644 --- a/examples/utilities/render/stats.qml +++ b/examples/utilities/render/stats.qml @@ -80,11 +80,6 @@ Item { label: "GPU", color: "#1AC567" }, - { - prop: "frameTextureCount", - label: "Frame", - color: "#E2334D" - }, { prop: "textureGPUTransferCount", label: "Transfer", @@ -114,13 +109,7 @@ Item { prop: "textureGPUVirtualMemoryUsage", label: "GPU Virtual", color: "#9495FF" - }, - { - prop: "frameTextureMemoryUsage", - label: "Frame", - color: "#E2334D" } - ] } @@ -170,6 +159,24 @@ Item { ] } + PlotPerf { + title: "State Changes" + height: parent.evalEvenHeight() + object: stats.config + plots: [ + { + prop: "frameTextureCount", + label: "Textures", + color: "#00B4EF" + }, + { + prop: "frameSetPipelineCount", + label: "Pipelines", + color: "#E2334D" + } + ] + } + property var drawOpaqueConfig: Render.getConfig("DrawOpaqueDeferred") property var drawTransparentConfig: Render.getConfig("DrawTransparentDeferred") property var drawLightConfig: Render.getConfig("DrawLight") diff --git a/libraries/gpu/src/gpu/Context.h b/libraries/gpu/src/gpu/Context.h index 869db97be7..5325d600f4 100644 --- a/libraries/gpu/src/gpu/Context.h +++ b/libraries/gpu/src/gpu/Context.h @@ -39,6 +39,8 @@ public: int _DSNumAPIDrawcalls = 0; int _DSNumDrawcalls = 0; int _DSNumTriangles = 0; + + int _PSNumSetPipelines = 0; ContextStats() {} ContextStats(const ContextStats& stats) = default; diff --git a/libraries/gpu/src/gpu/GLBackendPipeline.cpp b/libraries/gpu/src/gpu/GLBackendPipeline.cpp index 60ec478a8e..36554f0c3f 100755 --- a/libraries/gpu/src/gpu/GLBackendPipeline.cpp +++ b/libraries/gpu/src/gpu/GLBackendPipeline.cpp @@ -64,6 +64,9 @@ void GLBackend::do_setPipeline(Batch& batch, size_t paramOffset) { return; } + // A true new Pipeline + _stats._PSNumSetPipelines++; + // null pipeline == reset if (!pipeline) { _pipeline._pipeline.reset(); diff --git a/libraries/render/src/render/EngineStats.cpp b/libraries/render/src/render/EngineStats.cpp index 4b0936d326..a17845134a 100644 --- a/libraries/render/src/render/EngineStats.cpp +++ b/libraries/render/src/render/EngineStats.cpp @@ -49,5 +49,7 @@ void EngineStats::run(const SceneContextPointer& sceneContext, const RenderConte config->frameTextureRate = config->frameTextureCount * frequency; config->frameTextureMemoryUsage = _gpuStats._RSAmountTextureMemoryBounded - gpuStats._RSAmountTextureMemoryBounded; + config->frameSetPipelineCount = _gpuStats._PSNumSetPipelines - gpuStats._PSNumSetPipelines; + config->emitDirty(); } diff --git a/libraries/render/src/render/EngineStats.h b/libraries/render/src/render/EngineStats.h index ab58d2af38..e777e60a4e 100644 --- a/libraries/render/src/render/EngineStats.h +++ b/libraries/render/src/render/EngineStats.h @@ -47,6 +47,9 @@ namespace render { Q_PROPERTY(quint32 frameTextureRate MEMBER frameTextureRate NOTIFY dirty) Q_PROPERTY(quint32 frameTextureMemoryUsage MEMBER frameTextureMemoryUsage NOTIFY dirty) + Q_PROPERTY(quint32 frameSetPipelineCount MEMBER frameSetPipelineCount NOTIFY dirty) + + public: EngineStatsConfig() : Job::Config(true) {} @@ -73,6 +76,10 @@ namespace render { quint32 frameTextureRate{ 0 }; qint64 frameTextureMemoryUsage{ 0 }; + quint32 frameSetPipelineCount{ 0 }; + + + void emitDirty() { emit dirty(); } signals: