From 56bc962d36fbf03bbe952f6c6316bc636c033d6b Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sat, 23 Oct 2021 10:13:47 -0700 Subject: [PATCH] Changed preset framerates. Added preset. --- .../dialogs/graphics/GraphicsSettings.qml | 14 ++++++++ .../settingsApp/general/General.qml | 9 +++++ interface/src/PerformanceManager.cpp | 33 +++++++++++++------ interface/src/PerformanceManager.h | 1 + .../PerformanceScriptingInterface.cpp | 2 +- .../scripting/PerformanceScriptingInterface.h | 1 + libraries/platform/src/platform/Profiler.cpp | 2 +- libraries/platform/src/platform/Profiler.h | 1 + 8 files changed, 51 insertions(+), 12 deletions(-) diff --git a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml index 6e345caaf7..188e8022fb 100644 --- a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml +++ b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml @@ -52,6 +52,20 @@ Item { Layout.preferredWidth: parent.width spacing: 0 + HifiControlsUit.RadioButton { + id: performanceLowPower + colorScheme: hifi.colorSchemes.dark + height: 18 + fontSize: 16 + leftPadding: 0 + text: "Low Power" + checked: Performance.getPerformancePreset() === PerformanceEnums.LOW_POWER + onClicked: { + Performance.setPerformancePreset(PerformanceEnums.LOW_POWER); + root.refreshAllDropdowns(); + } + } + HifiControlsUit.RadioButton { id: performanceLow colorScheme: hifi.colorSchemes.dark diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml index 6a59816af8..2c17ecf6c3 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml @@ -174,6 +174,15 @@ Flickable { Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin spacing: simplifiedUI.margins.settings.spacingBetweenRadiobuttons + SimplifiedControls.RadioButton { + id: performanceLow + text: "Low Power Quality" + (PlatformInfo.getTierProfiled() === PerformanceEnums.LOW_POWER ? " (Recommended)" : "") + checked: Performance.getPerformancePreset() === PerformanceEnums.LOW_POWER + onClicked: { + Performance.setPerformancePreset(PerformanceEnums.LOW_POWER); + } + } + SimplifiedControls.RadioButton { id: performanceLow text: "Low Quality" + (PlatformInfo.getTierProfiled() === PerformanceEnums.LOW ? " (Recommended)" : "") diff --git a/interface/src/PerformanceManager.cpp b/interface/src/PerformanceManager.cpp index 1ff2319b1b..c4c6241a21 100644 --- a/interface/src/PerformanceManager.cpp +++ b/interface/src/PerformanceManager.cpp @@ -29,10 +29,11 @@ void PerformanceManager::setupPerformancePresetSettings(bool evaluatePlatformTie // Here is the mapping between platformTier and performance profile const std::array platformToPerformancePresetMap = { { - PerformanceManager::PerformancePreset::MID, // platform::Profiler::UNKNOWN - PerformanceManager::PerformancePreset::LOW, // platform::Profiler::LOW - PerformanceManager::PerformancePreset::MID, // platform::Profiler::MID - PerformanceManager::PerformancePreset::HIGH // platform::Profiler::HIGH + PerformanceManager::PerformancePreset::MID, // platform::Profiler::UNKNOWN + PerformanceManager::PerformancePreset::LOW_POWER, // platform::Profiler::LOW_POWER + PerformanceManager::PerformancePreset::LOW, // platform::Profiler::LOW + PerformanceManager::PerformancePreset::MID, // platform::Profiler::MID + PerformanceManager::PerformancePreset::HIGH // platform::Profiler::HIGH } }; // What is our profile? @@ -94,7 +95,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP DependencyManager::get()->setWorldDetailQuality(WORLD_DETAIL_HIGH); - break; + break; case PerformancePreset::MID: RenderScriptingInterface::getInstance()->setRenderMethod((isDeferredCapable ? RenderScriptingInterface::RenderMethod::DEFERRED : @@ -103,11 +104,21 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommendedPpiScale); RenderScriptingInterface::getInstance()->setShadowsEnabled(false); - qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE); + qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME); DependencyManager::get()->setWorldDetailQuality(WORLD_DETAIL_MEDIUM); - break; + break; case PerformancePreset::LOW: + RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::FORWARD); + RenderScriptingInterface::getInstance()->setShadowsEnabled(false); + qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME); + + RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommandedPpiScale); + + DependencyManager::get()->setWorldDetailQuality(WORLD_DETAIL_LOW); + + break; + case PerformancePreset::LOW_POWER: RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::FORWARD); RenderScriptingInterface::getInstance()->setShadowsEnabled(false); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::ECO); @@ -116,10 +127,12 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP DependencyManager::get()->setWorldDetailQuality(WORLD_DETAIL_LOW); - break; - case PerformancePreset::UNKNOWN: + break; + case + PerformancePreset::UNKNOWN: + // Intentionally unbroken. default: - // Do nothing anymore + // Do nothing. break; } } diff --git a/interface/src/PerformanceManager.h b/interface/src/PerformanceManager.h index f28d56d6ff..c1e451f54b 100644 --- a/interface/src/PerformanceManager.h +++ b/interface/src/PerformanceManager.h @@ -21,6 +21,7 @@ class PerformanceManager { public: enum PerformancePreset { UNKNOWN = 0, // Matching the platform Tier profiles enumeration for coherence + LOW_POWER, LOW, MID, HIGH, diff --git a/interface/src/scripting/PerformanceScriptingInterface.cpp b/interface/src/scripting/PerformanceScriptingInterface.cpp index 33ad9a3f95..ec56e83323 100644 --- a/interface/src/scripting/PerformanceScriptingInterface.cpp +++ b/interface/src/scripting/PerformanceScriptingInterface.cpp @@ -29,7 +29,7 @@ PerformanceScriptingInterface::PerformancePreset PerformanceScriptingInterface:: } QStringList PerformanceScriptingInterface::getPerformancePresetNames() const { - static const QStringList performancePresetNames = { "UNKNOWN", "LOW", "MID", "HIGH" }; + static const QStringList performancePresetNames = { "UNKNOWN", "LOW_POWER", "LOW", "MID", "HIGH" }; return performancePresetNames; } diff --git a/interface/src/scripting/PerformanceScriptingInterface.h b/interface/src/scripting/PerformanceScriptingInterface.h index d5048115c7..76e58f29b6 100644 --- a/interface/src/scripting/PerformanceScriptingInterface.h +++ b/interface/src/scripting/PerformanceScriptingInterface.h @@ -57,6 +57,7 @@ public: // PerformanceManager PerformancePreset tri state level enums enum PerformancePreset { UNKNOWN = PerformanceManager::PerformancePreset::UNKNOWN, + LOW_POWER = PerformanceManager::PerformancePreset::LOW_POWER, LOW = PerformanceManager::PerformancePreset::LOW, MID = PerformanceManager::PerformancePreset::MID, HIGH = PerformanceManager::PerformancePreset::HIGH, diff --git a/libraries/platform/src/platform/Profiler.cpp b/libraries/platform/src/platform/Profiler.cpp index d805fd8ebc..f64cc66059 100644 --- a/libraries/platform/src/platform/Profiler.cpp +++ b/libraries/platform/src/platform/Profiler.cpp @@ -16,7 +16,7 @@ using namespace platform; -const std::array Profiler::TierNames = {{ "UNKNOWN", "LOW", "MID", "HIGH" }}; +const std::array Profiler::TierNames = {{ "UNKNOWN", "LOW_POWER", "LOW", "MID", "HIGH" }}; bool filterOnComputer(const platform::json& computer, Profiler::Tier& tier); diff --git a/libraries/platform/src/platform/Profiler.h b/libraries/platform/src/platform/Profiler.h index c47f2587f2..eb8a7c4d11 100644 --- a/libraries/platform/src/platform/Profiler.h +++ b/libraries/platform/src/platform/Profiler.h @@ -19,6 +19,7 @@ class Profiler { public: enum Tier { UNKNOWN = 0, + LOW_POWER, LOW, MID, HIGH,