mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #8886 from jherico/more_gpu_stats
Add free GPU memory to the displayed stats
This commit is contained in:
commit
8efa394bfa
7 changed files with 26 additions and 3 deletions
|
@ -193,6 +193,9 @@ Item {
|
|||
text: "Triangles: " + root.triangles +
|
||||
" / Material Switches: " + root.materialSwitches
|
||||
}
|
||||
StatText {
|
||||
text: "GPU Free Memory: " + root.gpuFreeMemory + " MB";
|
||||
}
|
||||
StatText {
|
||||
text: "GPU Textures: ";
|
||||
}
|
||||
|
|
|
@ -111,7 +111,6 @@ void Stats::updateStats(bool force) {
|
|||
PerformanceTimer::setActive(shouldDisplayTimingDetail);
|
||||
}
|
||||
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||
// we need to take one avatar out so we don't include ourselves
|
||||
|
@ -293,7 +292,7 @@ void Stats::updateStats(bool force) {
|
|||
STAT_UPDATE(gpuTextureVirtualMemory, (int)BYTES_TO_MB(gpu::Texture::getTextureGPUVirtualMemoryUsage()));
|
||||
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()));
|
||||
|
||||
// Incoming packets
|
||||
QLocale locale(QLocale::English);
|
||||
|
|
|
@ -95,6 +95,7 @@ class Stats : public QQuickItem {
|
|||
STATS_PROPERTY(int, gpuTextureVirtualMemory, 0)
|
||||
STATS_PROPERTY(int, gpuTextureSparseMemory, 0)
|
||||
STATS_PROPERTY(int, gpuSparseTextureEnabled, 0)
|
||||
STATS_PROPERTY(int, gpuFreeMemory, 0)
|
||||
|
||||
public:
|
||||
static Stats* getInstance();
|
||||
|
@ -188,6 +189,7 @@ signals:
|
|||
void gpuTextureVirtualMemoryChanged();
|
||||
void gpuTextureSparseMemoryChanged();
|
||||
void gpuSparseTextureEnabledChanged();
|
||||
void gpuFreeMemoryChanged();
|
||||
|
||||
private:
|
||||
int _recentMaxPackets{ 0 } ; // recent max incoming voxel packets to process
|
||||
|
|
|
@ -630,6 +630,8 @@ void OpenGLDisplayPlugin::present() {
|
|||
PROFILE_RANGE_EX("internalPresent", 0xff00ffff, (uint64_t)presentCount())
|
||||
internalPresent();
|
||||
}
|
||||
|
||||
gpu::Backend::setFreeGPUMemory(gpu::gl::getFreeDedicatedMemory());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ private:
|
|||
void destroyTexture(GLuint texture) {
|
||||
--_allTextureCount;
|
||||
auto size = _textureSizes[texture];
|
||||
assert(getMemoryForSize(size) < _totalTextureUsage);
|
||||
assert(getMemoryForSize(size) <= _totalTextureUsage);
|
||||
_totalTextureUsage -= getMemoryForSize(size);
|
||||
_textureSizes.erase(texture);
|
||||
glDeleteTextures(1, &texture);
|
||||
|
|
|
@ -162,6 +162,7 @@ Backend::TransformCamera Backend::TransformCamera::getEyeCamera(int eye, const S
|
|||
}
|
||||
|
||||
// Counters for Buffer and Texture usage in GPU/Context
|
||||
std::atomic<Size> Context::_freeGPUMemory { 0 };
|
||||
std::atomic<uint32_t> Context::_fenceCount { 0 };
|
||||
std::atomic<uint32_t> Context::_bufferGPUCount { 0 };
|
||||
std::atomic<Buffer::Size> Context::_bufferGPUMemoryUsage { 0 };
|
||||
|
@ -173,6 +174,14 @@ std::atomic<Texture::Size> Context::_textureGPUVirtualMemoryUsage{ 0 };
|
|||
std::atomic<Texture::Size> Context::_textureGPUSparseMemoryUsage { 0 };
|
||||
std::atomic<uint32_t> Context::_textureGPUTransferCount { 0 };
|
||||
|
||||
void Context::setFreeGPUMemory(Size size) {
|
||||
_freeGPUMemory.store(size);
|
||||
}
|
||||
|
||||
Size Context::getFreeGPUMemory() {
|
||||
return _freeGPUMemory.load();
|
||||
}
|
||||
|
||||
void Context::incrementBufferGPUCount() {
|
||||
static std::atomic<uint32_t> max { 0 };
|
||||
auto total = ++_bufferGPUCount;
|
||||
|
@ -272,6 +281,7 @@ void Context::incrementTextureGPUTransferCount() {
|
|||
qCDebug(gpulogging) << "New max GPU textures transfers" << total;
|
||||
}
|
||||
}
|
||||
|
||||
void Context::decrementTextureGPUTransferCount() {
|
||||
--_textureGPUTransferCount;
|
||||
}
|
||||
|
@ -308,6 +318,8 @@ uint32_t Context::getTextureGPUTransferCount() {
|
|||
return _textureGPUTransferCount.load();
|
||||
}
|
||||
|
||||
void Backend::setFreeGPUMemory(Size size) { Context::setFreeGPUMemory(size); }
|
||||
Resource::Size Backend::getFreeGPUMemory() { return Context::getFreeGPUMemory(); }
|
||||
void Backend::incrementBufferGPUCount() { Context::incrementBufferGPUCount(); }
|
||||
void Backend::decrementBufferGPUCount() { Context::decrementBufferGPUCount(); }
|
||||
void Backend::updateBufferGPUMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize) { Context::updateBufferGPUMemoryUsage(prevObjectSize, newObjectSize); }
|
||||
|
|
|
@ -89,6 +89,8 @@ public:
|
|||
|
||||
// These should only be accessed by Backend implementation to repport the buffer and texture allocations,
|
||||
// they are NOT public calls
|
||||
static Resource::Size getFreeGPUMemory();
|
||||
static void setFreeGPUMemory(Resource::Size prevObjectSize);
|
||||
static void incrementBufferGPUCount();
|
||||
static void decrementBufferGPUCount();
|
||||
static void updateBufferGPUMemoryUsage(Resource::Size prevObjectSize, Resource::Size newObjectSize);
|
||||
|
@ -205,6 +207,7 @@ public:
|
|||
|
||||
static uint32_t getTextureGPUCount();
|
||||
static uint32_t getTextureGPUSparseCount();
|
||||
static Size getFreeGPUMemory();
|
||||
static Size getTextureGPUMemoryUsage();
|
||||
static Size getTextureGPUVirtualMemoryUsage();
|
||||
static Size getTextureGPUSparseMemoryUsage();
|
||||
|
@ -238,6 +241,7 @@ protected:
|
|||
static void incrementFenceCount();
|
||||
static void decrementFenceCount();
|
||||
|
||||
static void setFreeGPUMemory(Size size);
|
||||
static void incrementTextureGPUCount();
|
||||
static void decrementTextureGPUCount();
|
||||
static void incrementTextureGPUSparseCount();
|
||||
|
@ -249,6 +253,7 @@ protected:
|
|||
static void decrementTextureGPUTransferCount();
|
||||
|
||||
// Buffer, Texture and Fence Counters
|
||||
static std::atomic<Size> _freeGPUMemory;
|
||||
static std::atomic<uint32_t> _fenceCount;
|
||||
|
||||
static std::atomic<uint32_t> _bufferGPUCount;
|
||||
|
|
Loading…
Reference in a new issue