Merge pull request #1422 from Penguin-Guru/master

Changed preset framerates; Add "low power" preset.
This commit is contained in:
Dale Glass 2021-11-06 19:30:01 +01:00 committed by GitHub
commit 35a420d312
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 50 additions and 12 deletions

View file

@ -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

View file

@ -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)" : "")

View file

@ -29,10 +29,11 @@ void PerformanceManager::setupPerformancePresetSettings(bool evaluatePlatformTie
// Here is the mapping between platformTier and performance profile
const std::array<PerformanceManager::PerformancePreset, platform::Profiler::NumTiers> 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?
@ -71,7 +72,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP
// eval recommended PPI and Scale
float recommendedPpiScale = 1.0f;
const float RECOMMENDED_PPI[] = { 200.0f, 120.f, 160.f, 250.f};
const float RECOMMENDED_PPI[] = { 200.0f, 200.0f, 120.f, 160.f, 250.f};
if (!masterDisplay.empty() && masterDisplay.count(platform::keys::display::ppi)) {
float ppi = masterDisplay[platform::keys::display::ppi];
// only scale if the actual ppi is higher than the recommended ppi
@ -94,7 +95,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP
DependencyManager::get<LODManager>()->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<LODManager>()->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(recommendedPpiScale);
DependencyManager::get<LODManager>()->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,11 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP
DependencyManager::get<LODManager>()->setWorldDetailQuality(WORLD_DETAIL_LOW);
break;
break;
case PerformancePreset::UNKNOWN:
// Intentionally unbroken.
default:
// Do nothing anymore
// Do nothing.
break;
}
}

View file

@ -21,6 +21,7 @@ class PerformanceManager {
public:
enum PerformancePreset {
UNKNOWN = 0, // Matching the platform Tier profiles enumeration for coherence
LOW_POWER,
LOW,
MID,
HIGH,

View file

@ -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;
}

View file

@ -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,

View file

@ -16,7 +16,7 @@
using namespace platform;
const std::array<const char*, Profiler::Tier::NumTiers> Profiler::TierNames = {{ "UNKNOWN", "LOW", "MID", "HIGH" }};
const std::array<const char*, Profiler::Tier::NumTiers> Profiler::TierNames = {{ "UNKNOWN", "LOW_POWER", "LOW", "MID", "HIGH" }};
bool filterOnComputer(const platform::json& computer, Profiler::Tier& tier);

View file

@ -19,6 +19,7 @@ class Profiler {
public:
enum Tier {
UNKNOWN = 0,
LOW_POWER,
LOW,
MID,
HIGH,