From ce627eeea1506d449f45742faa12c578eccb3c6b Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 24 Oct 2016 17:11:29 -0700 Subject: [PATCH] Updated metrics --- interface/resources/qml/Stats.qml | 9 +++++++++ interface/src/ui/Stats.cpp | 5 +++++ interface/src/ui/Stats.h | 6 ++++++ libraries/model/src/model/TextureMap.cpp | 8 ++++++++ 4 files changed, 28 insertions(+) diff --git a/interface/resources/qml/Stats.qml b/interface/resources/qml/Stats.qml index 2439aaf5c0..1c5df5c71d 100644 --- a/interface/resources/qml/Stats.qml +++ b/interface/resources/qml/Stats.qml @@ -205,6 +205,12 @@ Item { StatText { text: " Count: " + root.gpuTextures; } + StatText { + text: " Rectified: " + root.rectifiedTextureCount; + } + StatText { + text: " Decimated: " + root.decimatedTextureCount; + } StatText { text: " Sparse Count: " + root.gpuTexturesSparse; visible: 0 != root.gpuSparseTextureEnabled; @@ -228,6 +234,9 @@ Item { StatText { text: " Count: " + root.gpuTextures; } + StatText { + text: " Memory: " + root.gpuBufferMemory; + } StatText { text: "GL Swapchain Memory: " + root.glContextSwapchainMemory + " MB"; } diff --git a/interface/src/ui/Stats.cpp b/interface/src/ui/Stats.cpp index 8c4f71bb24..11660a332d 100644 --- a/interface/src/ui/Stats.cpp +++ b/interface/src/ui/Stats.cpp @@ -96,6 +96,8 @@ bool Stats::includeTimingRecord(const QString& name) { } \ } +extern std::atomic DECIMATED_TEXTURE_COUNT; +extern std::atomic RECTIFIED_TEXTURE_COUNT; void Stats::updateStats(bool force) { if (!force) { @@ -289,6 +291,7 @@ void Stats::updateStats(bool force) { } STAT_UPDATE(gpuBuffers, (int)gpu::Context::getBufferGPUCount()); + STAT_UPDATE(gpuBufferMemory, (int)BYTES_TO_MB(gpu::Context::getBufferGPUMemoryUsage())); STAT_UPDATE(gpuTextures, (int)gpu::Context::getTextureGPUCount()); STAT_UPDATE(gpuTexturesSparse, (int)gpu::Context::getTextureGPUSparseCount()); @@ -301,6 +304,8 @@ void Stats::updateStats(bool force) { STAT_UPDATE(gpuTextureSparseMemory, (int)BYTES_TO_MB(gpu::Texture::getTextureGPUSparseMemoryUsage())); STAT_UPDATE(gpuSparseTextureEnabled, gpu::Texture::getEnableSparseTextures() ? 1 : 0); STAT_UPDATE(gpuFreeMemory, (int)BYTES_TO_MB(gpu::Context::getFreeGPUMemory())); + STAT_UPDATE(rectifiedTextureCount, (int)RECTIFIED_TEXTURE_COUNT.load()); + STAT_UPDATE(decimatedTextureCount, (int)DECIMATED_TEXTURE_COUNT.load()); // Incoming packets QLocale locale(QLocale::English); diff --git a/interface/src/ui/Stats.h b/interface/src/ui/Stats.h index a98a99f093..76c6effed7 100644 --- a/interface/src/ui/Stats.h +++ b/interface/src/ui/Stats.h @@ -87,7 +87,10 @@ class Stats : public QQuickItem { STATS_PROPERTY(int, localElements, 0) STATS_PROPERTY(int, localInternal, 0) STATS_PROPERTY(int, localLeaves, 0) + STATS_PROPERTY(int, rectifiedTextureCount, 0) + STATS_PROPERTY(int, decimatedTextureCount, 0) STATS_PROPERTY(int, gpuBuffers, 0) + STATS_PROPERTY(int, gpuBufferMemory, 0) STATS_PROPERTY(int, gpuTextures, 0) STATS_PROPERTY(int, gpuTexturesSparse, 0) STATS_PROPERTY(int, glContextSwapchainMemory, 0) @@ -186,6 +189,7 @@ signals: void glContextSwapchainMemoryChanged(); void qmlTextureMemoryChanged(); void gpuBuffersChanged(); + void gpuBufferMemoryChanged(); void gpuTexturesChanged(); void gpuTexturesSparseChanged(); void gpuTextureMemoryChanged(); @@ -194,6 +198,8 @@ signals: void gpuTextureSparseMemoryChanged(); void gpuSparseTextureEnabledChanged(); void gpuFreeMemoryChanged(); + void rectifiedTextureCountChanged(); + void decimatedTextureCountChanged(); private: int _recentMaxPackets{ 0 } ; // recent max incoming voxel packets to process diff --git a/libraries/model/src/model/TextureMap.cpp b/libraries/model/src/model/TextureMap.cpp index 4a6bbf6f9a..3e346a564e 100755 --- a/libraries/model/src/model/TextureMap.cpp +++ b/libraries/model/src/model/TextureMap.cpp @@ -46,6 +46,9 @@ uvec2 rectifyToSparseSize(const uvec2& size) { return result; } +std::atomic DECIMATED_TEXTURE_COUNT { 0 }; +std::atomic RECTIFIED_TEXTURE_COUNT { 0 }; + QImage processSourceImage(const QImage& srcImage, bool cubemap) { const uvec2 srcImageSize = toGlm(srcImage.size()); uvec2 targetSize = srcImageSize; @@ -53,8 +56,12 @@ QImage processSourceImage(const QImage& srcImage, bool cubemap) { while (glm::any(glm::greaterThan(targetSize, MAX_TEXTURE_SIZE))) { targetSize /= 2; } + if (targetSize != srcImageSize) { + ++DECIMATED_TEXTURE_COUNT; + } if (!cubemap && needsSparseRectification(targetSize)) { + ++RECTIFIED_TEXTURE_COUNT; targetSize = rectifyToSparseSize(targetSize); } @@ -63,6 +70,7 @@ QImage processSourceImage(const QImage& srcImage, bool cubemap) { } if (targetSize != srcImageSize) { + qDebug() << "Resizing texture from " << srcImageSize.x << "x" << srcImageSize.y << " to " << targetSize.x << "x" << targetSize.y; return srcImage.scaled(fromGlm(targetSize)); }