Tweaked the description and setting name for the GPU statistics overlay.

This commit is contained in:
Leon Styhre 2020-08-15 09:33:08 +02:00
parent 7b76aa005f
commit 885bf61df0
5 changed files with 11 additions and 8 deletions

Binary file not shown.

View file

@ -678,9 +678,9 @@ void GuiMenu::openOtherSettings()
// GPU statistics. // GPU statistics.
auto gpu_statistics = std::make_shared<SwitchComponent>(mWindow); auto gpu_statistics = std::make_shared<SwitchComponent>(mWindow);
gpu_statistics->setState(Settings::getInstance()->getBool("DrawGPUStatistics")); gpu_statistics->setState(Settings::getInstance()->getBool("DisplayGPUStatistics"));
s->addWithLabel("GPU STATISTICS OVERLAY", gpu_statistics); s->addWithLabel("DISPLAY GPU STATISTICS OVERLAY", gpu_statistics);
s->addSaveFunc([gpu_statistics] { Settings::getInstance()->setBool("DrawGPUStatistics", s->addSaveFunc([gpu_statistics] { Settings::getInstance()->setBool("DisplayGPUStatistics",
gpu_statistics->getState()); }); gpu_statistics->getState()); });
// Hide Reboot System option in the quit menu. // Hide Reboot System option in the quit menu.

View file

@ -271,7 +271,7 @@ bool parseArgs(int argc, char* argv[])
i++; // Skip vsync value. i++; // Skip vsync value.
} }
else if (strcmp(argv[i], "--gpu-statistics") == 0) { else if (strcmp(argv[i], "--gpu-statistics") == 0) {
Settings::getInstance()->setBool("DrawGPUStatistics", "true"); Settings::getInstance()->setBool("DisplayGPUStatistics", "true");
} }
else if (strcmp(argv[i], "--force-full") == 0) { else if (strcmp(argv[i], "--force-full") == 0) {
Settings::getInstance()->setString("UIMode", "full"); Settings::getInstance()->setString("UIMode", "full");
@ -313,7 +313,7 @@ bool parseArgs(int argc, char* argv[])
#endif #endif
" --vsync [1/on or 0/off] Turn vsync on or off (default is on)\n" " --vsync [1/on or 0/off] Turn vsync on or off (default is on)\n"
" --max-vram [size] Max VRAM to use (in mebibytes) before swapping\n" " --max-vram [size] Max VRAM to use (in mebibytes) before swapping\n"
" --gpu-statistics Draw framerate and VRAM usage overlay\n" " --gpu-statistics Display framerate and VRAM usage overlay\n"
" --force-full Force the UI mode to Full\n" " --force-full Force the UI mode to Full\n"
" --force-kid Force the UI mode to Kid\n" " --force-kid Force the UI mode to Kid\n"
" --force-kiosk Force the UI mode to Kiosk\n" " --force-kiosk Force the UI mode to Kiosk\n"

View file

@ -204,7 +204,7 @@ void Settings::setDefaults()
mBoolMap["LocalArt"] = false; mBoolMap["LocalArt"] = false;
mBoolMap["ShowHiddenFiles"] = true; mBoolMap["ShowHiddenFiles"] = true;
mBoolMap["ShowHiddenGames"] = true; mBoolMap["ShowHiddenGames"] = true;
mBoolMap["DrawGPUStatistics"] = false; mBoolMap["DisplayGPUStatistics"] = false;
mBoolMap["ShowRebootSystem"] = true; mBoolMap["ShowRebootSystem"] = true;
mBoolMap["ShowPoweroffSystem"] = true; mBoolMap["ShowPoweroffSystem"] = true;

View file

@ -207,7 +207,7 @@ void Window::update(int deltaTime)
if (mFrameTimeElapsed > 500) { if (mFrameTimeElapsed > 500) {
mAverageDeltaTime = mFrameTimeElapsed / mFrameCountElapsed; mAverageDeltaTime = mFrameTimeElapsed / mFrameCountElapsed;
if (Settings::getInstance()->getBool("DrawGPUStatistics")) { if (Settings::getInstance()->getBool("DisplayGPUStatistics")) {
std::stringstream ss; std::stringstream ss;
// FPS. // FPS.
@ -216,6 +216,9 @@ void Window::update(int deltaTime)
ss << std::fixed << std::setprecision(2) << ss << std::fixed << std::setprecision(2) <<
((float)mFrameTimeElapsed / (float)mFrameCountElapsed) << " ms)"; ((float)mFrameTimeElapsed / (float)mFrameCountElapsed) << " ms)";
// The following calculations are not accurate, and the font calculation is completely
// broken. For now, still report the figures as it's somehow useful to locate memory
// leaks and similar. But this needs to be completely overhauled later on.
// VRAM. // VRAM.
float textureVramUsageMiB = TextureResource::getTotalMemUsage() / 1024.0f / 1024.0f; float textureVramUsageMiB = TextureResource::getTotalMemUsage() / 1024.0f / 1024.0f;
float textureTotalUsageMiB = TextureResource::getTotalTextureSize() / 1024.0f / 1024.0f; float textureTotalUsageMiB = TextureResource::getTotalTextureSize() / 1024.0f / 1024.0f;
@ -263,7 +266,7 @@ void Window::render()
if (!mRenderedHelpPrompts) if (!mRenderedHelpPrompts)
mHelp->render(transform); mHelp->render(transform);
if (Settings::getInstance()->getBool("DrawGPUStatistics") && mFrameDataText) { if (Settings::getInstance()->getBool("DisplayGPUStatistics") && mFrameDataText) {
Renderer::setMatrix(Transform4x4f::Identity()); Renderer::setMatrix(Transform4x4f::Identity());
mDefaultFonts.at(1)->renderTextCache(mFrameDataText.get()); mDefaultFonts.at(1)->renderTextCache(mFrameDataText.get());
} }