diff --git a/interface/src/PerformanceManager.cpp b/interface/src/PerformanceManager.cpp index fac55661b7..2b7dc30b96 100644 --- a/interface/src/PerformanceManager.cpp +++ b/interface/src/PerformanceManager.cpp @@ -10,14 +10,20 @@ // #include "PerformanceManager.h" +#include "scripting/RenderScriptingInterface.h" + PerformanceManager::PerformanceManager() { } void PerformanceManager::setPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) { - _performanceProfileSettingLock.withWriteLock([&] { - _performanceProfileSetting.set((int)performanceProfile); - }); + if (getPerformanceProfile() != performanceProfile) { + _performanceProfileSettingLock.withWriteLock([&] { + _performanceProfileSetting.set((int)performanceProfile); + }); + + applyPerformanceProfile(performanceProfile); + } } PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile() const { @@ -28,4 +34,30 @@ PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile }); return profile; -} \ No newline at end of file +} + +void PerformanceManager::applyPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) { + + switch (performanceProfile) { + case PerformanceProfile::HIGH: + RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED); + RenderScriptingInterface::getInstance()->setShadowsEnabled(true); + qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE); + + break; + case PerformanceProfile::MID: + RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED); + RenderScriptingInterface::getInstance()->setShadowsEnabled(false); + qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE); + + break; + case PerformanceProfile::LOW: + RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::FORWARD); + RenderScriptingInterface::getInstance()->setShadowsEnabled(false); + qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::ECO); + + break; + default: + break; + } +} diff --git a/interface/src/PerformanceManager.h b/interface/src/PerformanceManager.h index ea24f260b8..8417650aaf 100644 --- a/interface/src/PerformanceManager.h +++ b/interface/src/PerformanceManager.h @@ -35,6 +35,9 @@ public: private: mutable ReadWriteLockable _performanceProfileSettingLock; Setting::Handle _performanceProfileSetting { "performanceProfile", PerformanceManager::PerformanceProfile::MID }; + + // The concrete performance profile changes + void applyPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile); }; #endif diff --git a/scripts/developer/utilities/render/luci/RenderSettings.qml b/scripts/developer/utilities/render/luci/RenderSettings.qml index 042ea3776b..e9e3906dfe 100644 --- a/scripts/developer/utilities/render/luci/RenderSettings.qml +++ b/scripts/developer/utilities/render/luci/RenderSettings.qml @@ -19,6 +19,14 @@ Column { anchors.fill: parent id: theGrapchicsSettings; + Prop.PropEnum { + label: "Performance Profile" + //object: Performance + valueVarSetter: Performance.setPerformanceProfile + valueVarGetter: Performance.getPerformanceProfile + enums: Performance.getPerformanceProfileNames() + } + Prop.PropEnum { label: "Refresh Rate Profile" //object: Performance