From b88deb52b093c05826ed2de9ca027f682265075e Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Thu, 30 May 2019 12:03:44 -0700 Subject: [PATCH] Cleaning up the interface for the Performance PRESET and the associated debug ui --- interface/src/Application.cpp | 14 ++-- interface/src/PerformanceManager.cpp | 30 ++++---- interface/src/PerformanceManager.h | 14 ++-- .../PerformanceScriptingInterface.cpp | 14 ++-- .../scripting/PerformanceScriptingInterface.h | 18 ++--- .../render/luci/PerformanceSettings.qml | 43 +++++++++++ .../utilities/render/luci/Platform.qml | 67 +++++++++++++++++ .../utilities/render/luci/RenderSettings.qml | 21 +----- .../developer/utilities/render/luci/qmldir | 6 +- .../utilities/render/performanceSetup.js | 6 ++ .../utilities/render/performanceSetup.qml | 56 ++++++++++++++ .../developer/utilities/render/platform.js | 2 +- .../developer/utilities/render/platform.qml | 75 ------------------- 13 files changed, 225 insertions(+), 141 deletions(-) create mode 100644 scripts/developer/utilities/render/luci/PerformanceSettings.qml create mode 100644 scripts/developer/utilities/render/luci/Platform.qml create mode 100644 scripts/developer/utilities/render/performanceSetup.js create mode 100644 scripts/developer/utilities/render/performanceSetup.qml delete mode 100644 scripts/developer/utilities/render/platform.qml diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 74b812aa65..ae226598d1 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5366,18 +5366,18 @@ void Application::loadSettings() { // A bunch of Performance, Simulation and Render settings will be set to a matching default value from this // Here is the mapping between pelatformTIer and performance profile - const std::array platformToPerformanceProfileMap = {{ - PerformanceManager::PerformanceProfile::MID, // platform::Profiler::UNKNOWN - PerformanceManager::PerformanceProfile::LOW, // platform::Profiler::LOW - PerformanceManager::PerformanceProfile::MID, // platform::Profiler::MID - PerformanceManager::PerformanceProfile::HIGH // platform::Profiler::HIGH + const std::array 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 }}; // What is our profile? auto platformTier = platform::Profiler::profilePlatform(); - // Then let's assign the performance profile setting from it - getPerformanceManager().setPerformanceProfile(platformToPerformanceProfileMap[platformTier]); + // Then let's assign the performance preset setting from it + getPerformanceManager().setPerformancePreset(platformToPerformancePresetMap[platformTier]); } diff --git a/interface/src/PerformanceManager.cpp b/interface/src/PerformanceManager.cpp index 2b7dc30b96..9e96763ff6 100644 --- a/interface/src/PerformanceManager.cpp +++ b/interface/src/PerformanceManager.cpp @@ -16,42 +16,42 @@ PerformanceManager::PerformanceManager() { } -void PerformanceManager::setPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) { - if (getPerformanceProfile() != performanceProfile) { - _performanceProfileSettingLock.withWriteLock([&] { - _performanceProfileSetting.set((int)performanceProfile); +void PerformanceManager::setPerformancePreset(PerformanceManager::PerformancePreset preset) { + if (getPerformancePreset() != preset) { + _performancePresetSettingLock.withWriteLock([&] { + _performancePresetSetting.set((int)preset); }); - applyPerformanceProfile(performanceProfile); + applyPerformancePreset(preset); } } -PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile() const { - PerformanceProfile profile = PerformanceProfile::MID; +PerformanceManager::PerformancePreset PerformanceManager::getPerformancePreset() const { + PerformancePreset preset = PerformancePreset::MID; - profile = (PerformanceProfile) _performanceProfileSettingLock.resultWithReadLock([&] { - return _performanceProfileSetting.get(); + preset = (PerformancePreset) _performancePresetSettingLock.resultWithReadLock([&] { + return _performancePresetSetting.get(); }); - return profile; + return preset; } -void PerformanceManager::applyPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) { +void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformancePreset preset) { - switch (performanceProfile) { - case PerformanceProfile::HIGH: + switch (preset) { + case PerformancePreset::HIGH: RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED); RenderScriptingInterface::getInstance()->setShadowsEnabled(true); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE); break; - case PerformanceProfile::MID: + case PerformancePreset::MID: RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED); RenderScriptingInterface::getInstance()->setShadowsEnabled(false); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE); break; - case PerformanceProfile::LOW: + case PerformancePreset::LOW: RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::FORWARD); RenderScriptingInterface::getInstance()->setShadowsEnabled(false); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::ECO); diff --git a/interface/src/PerformanceManager.h b/interface/src/PerformanceManager.h index 8417650aaf..14742626c3 100644 --- a/interface/src/PerformanceManager.h +++ b/interface/src/PerformanceManager.h @@ -19,7 +19,7 @@ class PerformanceManager { public: - enum PerformanceProfile { + enum PerformancePreset { LOW = 0, MID, HIGH, @@ -29,15 +29,15 @@ public: PerformanceManager(); ~PerformanceManager() = default; - void setPerformanceProfile(PerformanceProfile performanceProfile); - PerformanceProfile getPerformanceProfile() const; + void setPerformancePreset(PerformancePreset performancePreset); + PerformancePreset getPerformancePreset() const; private: - mutable ReadWriteLockable _performanceProfileSettingLock; - Setting::Handle _performanceProfileSetting { "performanceProfile", PerformanceManager::PerformanceProfile::MID }; + mutable ReadWriteLockable _performancePresetSettingLock; + Setting::Handle _performancePresetSetting { "performancePreset", PerformanceManager::PerformancePreset::MID }; - // The concrete performance profile changes - void applyPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile); + // The concrete performance preset changes + void applyPerformancePreset(PerformanceManager::PerformancePreset performancePreset); }; #endif diff --git a/interface/src/scripting/PerformanceScriptingInterface.cpp b/interface/src/scripting/PerformanceScriptingInterface.cpp index b948e2167c..4f7c2b0fda 100644 --- a/interface/src/scripting/PerformanceScriptingInterface.cpp +++ b/interface/src/scripting/PerformanceScriptingInterface.cpp @@ -19,17 +19,17 @@ PerformanceScriptingInterface::PerformanceScriptingInterface() { }); } -void PerformanceScriptingInterface::setPerformanceProfile(PerformanceProfile performanceProfile) { - qApp->getPerformanceManager().setPerformanceProfile((PerformanceManager::PerformanceProfile)performanceProfile); +void PerformanceScriptingInterface::setPerformancePreset(PerformancePreset performancePreset) { + qApp->getPerformanceManager().setPerformancePreset((PerformanceManager::PerformancePreset)performancePreset); } -PerformanceScriptingInterface::PerformanceProfile PerformanceScriptingInterface::getPerformanceProfile() const { - return (PerformanceScriptingInterface::PerformanceProfile)qApp->getPerformanceManager().getPerformanceProfile(); +PerformanceScriptingInterface::PerformancePreset PerformanceScriptingInterface::getPerformancePreset() const { + return (PerformanceScriptingInterface::PerformancePreset)qApp->getPerformanceManager().getPerformancePreset(); } -QStringList PerformanceScriptingInterface::getPerformanceProfileNames() const { - static const QStringList performanceProfileNames = { "Low", "Mid", "High" }; - return performanceProfileNames; +QStringList PerformanceScriptingInterface::getPerformancePresetNames() const { + static const QStringList performancePresetNames = { "Low", "Mid", "High" }; + return performancePresetNames; } void PerformanceScriptingInterface::setRefreshRateProfile(RefreshRateProfile refreshRateProfile) { diff --git a/interface/src/scripting/PerformanceScriptingInterface.h b/interface/src/scripting/PerformanceScriptingInterface.h index a13d1bf887..3dbcd620fa 100644 --- a/interface/src/scripting/PerformanceScriptingInterface.h +++ b/interface/src/scripting/PerformanceScriptingInterface.h @@ -22,13 +22,13 @@ class PerformanceScriptingInterface : public QObject { Q_OBJECT public: - // PerformanceManager PerformanceProfile tri state level enums - enum PerformanceProfile { - LOW = PerformanceManager::PerformanceProfile::LOW, - MID = PerformanceManager::PerformanceProfile::MID, - HIGH = PerformanceManager::PerformanceProfile::HIGH, + // PerformanceManager PerformancePreset tri state level enums + enum PerformancePreset { + LOW = PerformanceManager::PerformancePreset::LOW, + MID = PerformanceManager::PerformancePreset::MID, + HIGH = PerformanceManager::PerformancePreset::HIGH, }; - Q_ENUM(PerformanceProfile) + Q_ENUM(PerformancePreset) // Must match RefreshRateManager enums enum RefreshRateProfile { @@ -43,9 +43,9 @@ public: public slots: - void setPerformanceProfile(PerformanceProfile performanceProfile); - PerformanceProfile getPerformanceProfile() const; - QStringList getPerformanceProfileNames() const; + void setPerformancePreset(PerformancePreset performancePreset); + PerformancePreset getPerformancePreset() const; + QStringList getPerformancePresetNames() const; void setRefreshRateProfile(RefreshRateProfile refreshRateProfile); RefreshRateProfile getRefreshRateProfile() const; diff --git a/scripts/developer/utilities/render/luci/PerformanceSettings.qml b/scripts/developer/utilities/render/luci/PerformanceSettings.qml new file mode 100644 index 0000000000..7bb923a25e --- /dev/null +++ b/scripts/developer/utilities/render/luci/PerformanceSettings.qml @@ -0,0 +1,43 @@ +// +// Performance Settings.qml +// +// Created by Sam Gateau on 5/28/2019 +// Copyright 2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html +// +import QtQuick 2.7 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 + +import "../../lib/prop" as Prop + +Column { + anchors.left: parent.left + anchors.right: parent.right + + Prop.PropString { + label: "Platform Tier" + //object: Performance + valueVarSetter: function (v) {} + valueVarGetter: function () { + return PlatformInfo.getPlatformTierNames()[PlatformInfo.getTierProfiled()]; } + } + + Prop.PropEnum { + label: "Performance Preset" + //object: Performance + valueVarSetter: Performance.setPerformancePreset + valueVarGetter: Performance.getPerformancePreset + enums: Performance.getPerformancePresetNames() + } + + Prop.PropEnum { + label: "Refresh Rate Profile" + //object: Performance + valueVarSetter: Performance.setRefreshRateProfile + valueVarGetter: Performance.getRefreshRateProfile + enums: Performance.getRefreshRateProfileNames() + } +} diff --git a/scripts/developer/utilities/render/luci/Platform.qml b/scripts/developer/utilities/render/luci/Platform.qml new file mode 100644 index 0000000000..78a32b1749 --- /dev/null +++ b/scripts/developer/utilities/render/luci/Platform.qml @@ -0,0 +1,67 @@ +// +// platform.qml +// +// Created by Sam Gateau on 5/25/2019 +// Copyright 2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html +// +import QtQuick 2.7 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 + +import controlsUit 1.0 as HifiControls + +import "../../lib/prop" as Prop + +Column { + width: parent.width + + Prop.PropGroup { + id: computer + label: "Computer" + isUnfold: true + + Component.onCompleted: { + computer.populateFromObjectProps(JSON.parse(PlatformInfo.getComputer())) + } + } + Prop.PropGroup { + id: cpu + label: "CPU" + isUnfold: true + + Component.onCompleted: { + cpu.populateFromObjectProps(JSON.parse(PlatformInfo.getCPU(0))) + } + } + Prop.PropGroup { + id: memory + label: "Memory" + isUnfold: true + + Component.onCompleted: { + memory.populateFromObjectProps(JSON.parse(PlatformInfo.getMemory())) + } + } + Prop.PropGroup { + id: gpu + label: "GPU" + isUnfold: true + + Component.onCompleted: { + gpu.populateFromObjectProps(JSON.parse(PlatformInfo.getGPU(0))) + } + } + Prop.PropGroup { + id: display + label: "Display" + isUnfold: true + + Component.onCompleted: { + display.populateFromObjectProps(JSON.parse(PlatformInfo.getDisplay(0))) + } + } +} + diff --git a/scripts/developer/utilities/render/luci/RenderSettings.qml b/scripts/developer/utilities/render/luci/RenderSettings.qml index e9e3906dfe..906c117b3a 100644 --- a/scripts/developer/utilities/render/luci/RenderSettings.qml +++ b/scripts/developer/utilities/render/luci/RenderSettings.qml @@ -11,29 +11,12 @@ import QtQuick 2.7 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 -import controlsUit 1.0 as HifiControls - import "../../lib/prop" as Prop Column { - anchors.fill: parent - id: theGrapchicsSettings; + anchors.left: parent.left + anchors.right: parent.right - Prop.PropEnum { - label: "Performance Profile" - //object: Performance - valueVarSetter: Performance.setPerformanceProfile - valueVarGetter: Performance.getPerformanceProfile - enums: Performance.getPerformanceProfileNames() - } - - Prop.PropEnum { - label: "Refresh Rate Profile" - //object: Performance - valueVarSetter: Performance.setRefreshRateProfile - valueVarGetter: Performance.getRefreshRateProfile - enums: Performance.getRefreshRateProfileNames() - } Prop.PropEnum { label: "Render Method" diff --git a/scripts/developer/utilities/render/luci/qmldir b/scripts/developer/utilities/render/luci/qmldir index 7a7d6a8ca6..3ebd9fcd8d 100644 --- a/scripts/developer/utilities/render/luci/qmldir +++ b/scripts/developer/utilities/render/luci/qmldir @@ -4,4 +4,8 @@ ToneMapping 1.0 ToneMapping.qml BoundingBoxes 1.0 BoundingBoxes.qml Framebuffer 1.0 Framebuffer.qml Antialiasing 1.0 Antialiasing.qml -Culling 1.0 Culling.qml \ No newline at end of file +Culling 1.0 Culling.qml + +Platform 1.0 Platform.qml +RenderSettings 1.0 RenderSettings.qml +PerformanceSettings 1.0 PerformanceSettings.qml diff --git a/scripts/developer/utilities/render/performanceSetup.js b/scripts/developer/utilities/render/performanceSetup.js new file mode 100644 index 0000000000..a8c179e0e8 --- /dev/null +++ b/scripts/developer/utilities/render/performanceSetup.js @@ -0,0 +1,6 @@ +var window = Desktop.createWindow(Script.resolvePath('./performanceSetup.qml'), { + title: "Performance Setup", + presentationMode: Desktop.PresentationMode.NATIVE, + size: {x: 350, y: 700} +}); + diff --git a/scripts/developer/utilities/render/performanceSetup.qml b/scripts/developer/utilities/render/performanceSetup.qml new file mode 100644 index 0000000000..db7c5619a3 --- /dev/null +++ b/scripts/developer/utilities/render/performanceSetup.qml @@ -0,0 +1,56 @@ +// +// platformSetupInspector.qml +// +// Created by Sam Gateau on 5/30/2019 +// Copyright 2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html +// +import QtQuick 2.7 +import QtQuick.Controls 2.5 +import QtQuick.Layouts 1.3 + +import controlsUit 1.0 as HifiControls + +import "../lib/prop" as Prop +import "luci" + +Rectangle { + anchors.fill: parent + id: platform; + + Prop.Global { id: global;} + color: global.colorBack + + ScrollView { + anchors.fill: parent + clip: true + Column { + anchors.left: parent.left + anchors.right: parent.right + + Prop.PropFolderPanel { + label: "Performance Settings" + isUnfold: true + panelFrameData: Component { + PerformanceSettings {} + } + } + Prop.PropFolderPanel { + label: "Render Settings" + isUnfold: true + panelFrameData: Component { + RenderSettings {} + } + } + Prop.PropFolderPanel { + label: "Platform" + panelFrameData: Component { + Platform {} + } + } + } + } +} + diff --git a/scripts/developer/utilities/render/platform.js b/scripts/developer/utilities/render/platform.js index 9678bf3ff1..fbb7cbb8c4 100644 --- a/scripts/developer/utilities/render/platform.js +++ b/scripts/developer/utilities/render/platform.js @@ -10,7 +10,7 @@ PlatformInfo.getNumGPUs() PlatformInfo.getGPU(0) // {"driver":"25.21.14.1967","model":"NVIDIA GeForce GTX 1080","vendor":"NVIDIA GeForce GTX 1080","videoMemory":8079} -var window = Desktop.createWindow(Script.resolvePath('./platform.qml'), { +var window = Desktop.createWindow(Script.resolvePath('./luci/Platform.qml'), { title: "Platform", presentationMode: Desktop.PresentationMode.NATIVE, size: {x: 350, y: 700} diff --git a/scripts/developer/utilities/render/platform.qml b/scripts/developer/utilities/render/platform.qml deleted file mode 100644 index 775ad8e106..0000000000 --- a/scripts/developer/utilities/render/platform.qml +++ /dev/null @@ -1,75 +0,0 @@ -// -// platform.qml -// -// Created by Sam Gateau on 5/25/2019 -// Copyright 2019 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html -// -import QtQuick 2.7 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 - -import controlsUit 1.0 as HifiControls - -import "../lib/prop" as Prop - -Rectangle { - anchors.fill: parent - id: platform; - - Prop.Global { id: global;} - color: global.colorBack - - Column { - width: parent.width - - Prop.PropGroup { - id: computer - label: "Computer" - isUnfold: true - - Component.onCompleted: { - computer.populateFromObjectProps(JSON.parse(PlatformInfo.getComputer())) - } - } - Prop.PropGroup { - id: cpu - label: "CPU" - isUnfold: true - - Component.onCompleted: { - cpu.populateFromObjectProps(JSON.parse(PlatformInfo.getCPU(0))) - } - } - Prop.PropGroup { - id: memory - label: "Memory" - isUnfold: true - - Component.onCompleted: { - memory.populateFromObjectProps(JSON.parse(PlatformInfo.getMemory())) - } - } - Prop.PropGroup { - id: gpu - label: "GPU" - isUnfold: true - - Component.onCompleted: { - gpu.populateFromObjectProps(JSON.parse(PlatformInfo.getGPU(0))) - } - } - Prop.PropGroup { - id: display - label: "Display" - isUnfold: true - - Component.onCompleted: { - display.populateFromObjectProps(JSON.parse(PlatformInfo.getDisplay(0))) - } - } - } -} -