mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-18 23:48:45 +02:00
COnnect the profile tier to the performance setting and assign on first run or after reset...
This commit is contained in:
parent
473bd33515
commit
a212a8a36a
3 changed files with 47 additions and 4 deletions
|
@ -10,14 +10,20 @@
|
||||||
//
|
//
|
||||||
#include "PerformanceManager.h"
|
#include "PerformanceManager.h"
|
||||||
|
|
||||||
|
#include "scripting/RenderScriptingInterface.h"
|
||||||
|
|
||||||
PerformanceManager::PerformanceManager()
|
PerformanceManager::PerformanceManager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformanceManager::setPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) {
|
void PerformanceManager::setPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) {
|
||||||
|
if (getPerformanceProfile() != performanceProfile) {
|
||||||
_performanceProfileSettingLock.withWriteLock([&] {
|
_performanceProfileSettingLock.withWriteLock([&] {
|
||||||
_performanceProfileSetting.set((int)performanceProfile);
|
_performanceProfileSetting.set((int)performanceProfile);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
applyPerformanceProfile(performanceProfile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile() const {
|
PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile() const {
|
||||||
|
@ -29,3 +35,29 @@ PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,9 @@ public:
|
||||||
private:
|
private:
|
||||||
mutable ReadWriteLockable _performanceProfileSettingLock;
|
mutable ReadWriteLockable _performanceProfileSettingLock;
|
||||||
Setting::Handle<int> _performanceProfileSetting { "performanceProfile", PerformanceManager::PerformanceProfile::MID };
|
Setting::Handle<int> _performanceProfileSetting { "performanceProfile", PerformanceManager::PerformanceProfile::MID };
|
||||||
|
|
||||||
|
// The concrete performance profile changes
|
||||||
|
void applyPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,6 +19,14 @@ Column {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
id: theGrapchicsSettings;
|
id: theGrapchicsSettings;
|
||||||
|
|
||||||
|
Prop.PropEnum {
|
||||||
|
label: "Performance Profile"
|
||||||
|
//object: Performance
|
||||||
|
valueVarSetter: Performance.setPerformanceProfile
|
||||||
|
valueVarGetter: Performance.getPerformanceProfile
|
||||||
|
enums: Performance.getPerformanceProfileNames()
|
||||||
|
}
|
||||||
|
|
||||||
Prop.PropEnum {
|
Prop.PropEnum {
|
||||||
label: "Refresh Rate Profile"
|
label: "Refresh Rate Profile"
|
||||||
//object: Performance
|
//object: Performance
|
||||||
|
|
Loading…
Reference in a new issue