Updated metrics

This commit is contained in:
Brad Davis 2016-10-24 17:11:29 -07:00
parent a9bf2a5cd3
commit ce627eeea1
4 changed files with 28 additions and 0 deletions

View file

@ -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";
}

View file

@ -96,6 +96,8 @@ bool Stats::includeTimingRecord(const QString& name) {
} \
}
extern std::atomic<size_t> DECIMATED_TEXTURE_COUNT;
extern std::atomic<size_t> 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);

View file

@ -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

View file

@ -46,6 +46,9 @@ uvec2 rectifyToSparseSize(const uvec2& size) {
return result;
}
std::atomic<size_t> DECIMATED_TEXTURE_COUNT { 0 };
std::atomic<size_t> 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));
}