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
10//10//
11#include "PerformanceManager.h"11#include "PerformanceManager.h"
12 12
13#include "scripting/RenderScriptingInterface.h"
14
13PerformanceManager::PerformanceManager()15PerformanceManager::PerformanceManager()
14{16{
15}17}
16 18
17void PerformanceManager::setPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) {19void PerformanceManager::setPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) {
18 _performanceProfileSettingLock.withWriteLock([&] {20 if (getPerformanceProfile() != performanceProfile) {
19 _performanceProfileSetting.set((int)performanceProfile);21 _performanceProfileSettingLock.withWriteLock([&] {
20 });22 _performanceProfileSetting.set((int)performanceProfile);
23 });
24
25 applyPerformanceProfile(performanceProfile);
26 }
21}27}
22 28
23PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile() const {29PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile() const {
@@ -28,4 +34,30 @@ PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile · 4 unmodified lines
28 });34 });
29 35
30 return profile;36 return profile;
31}37}
38
39void 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