History

COnnect the profile tier to the performance setting and assign on first run or after reset...

Sam Gateau committed 7 years ago

Commit a212a8a1 parent 473bd333 files · +47 −4Browse files

Showing the changes to interface/src/PerformanceManager.cpp (1 of 3 files). Show all

Unified · Split

interface/src/PerformanceManager.cpp+36−4
@@ -10,14 +10,20 @@ · 9 unmodified lines
1010 //
1111 #include "PerformanceManager.h"
1212
13+#include "scripting/RenderScriptingInterface.h"
14+
1315 PerformanceManager::PerformanceManager()
1416 {
1517 }
1618
1719 void PerformanceManager::setPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) {
18− _performanceProfileSettingLock.withWriteLock([&] {
19− _performanceProfileSetting.set((int)performanceProfile);
20− });
20+ if (getPerformanceProfile() != performanceProfile) {
21+ _performanceProfileSettingLock.withWriteLock([&] {
22+ _performanceProfileSetting.set((int)performanceProfile);
23+ });
24+
25+ applyPerformanceProfile(performanceProfile);
26+ }
2127 }
2228
2329 PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile() const {
@@ -28,4 +34,30 @@ PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile · 4 unmodified lines
2834 });
2935
3036 return profile;
31−}
37+}
38+
39+void PerformanceManager::applyPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) {
40+
41+ switch (performanceProfile) {
42+ case PerformanceProfile::HIGH:
43+ RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED);
44+ RenderScriptingInterface::getInstance()->setShadowsEnabled(true);
45+ qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE);
46+
47+ break;
48+ case PerformanceProfile::MID:
49+ RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED);
50+ RenderScriptingInterface::getInstance()->setShadowsEnabled(false);
51+ qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE);
52+
53+ break;
54+ case PerformanceProfile::LOW:
55+ RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::FORWARD);
56+ RenderScriptingInterface::getInstance()->setShadowsEnabled(false);
57+ qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::ECO);
58+
59+ break;
60+ default:
61+ break;
62+ }
63+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t