mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-09 19:12:15 +02:00
Merge pull request #15698 from samcake/nut
BUGZ-544: Refine the LOD manager target rate with the Refreshrate current target
This commit is contained in:
commit
1748d0527f
13 changed files with 155 additions and 41 deletions
|
@ -269,6 +269,9 @@ Item {
|
|||
StatText {
|
||||
text: "GPU: " + root.gpuFrameTime.toFixed(1) + " ms"
|
||||
}
|
||||
StatText {
|
||||
text: "LOD Target: " + root.lodTargetFramerate + " Hz Angle: " + root.lodAngle + " deg"
|
||||
}
|
||||
StatText {
|
||||
text: "Drawcalls: " + root.drawcalls
|
||||
}
|
||||
|
|
|
@ -259,6 +259,35 @@ Item {
|
|||
visible: root.expanded;
|
||||
text: "Entity Servers In: " + root.entityPacketsInKbps + " kbps";
|
||||
}
|
||||
StatText {
|
||||
visible: !root.expanded
|
||||
text: "Octree Elements Server: " + root.serverElements +
|
||||
" Local: " + root.localElements;
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "Octree Sending Mode: " + root.sendingMode;
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "Octree Packets to Process: " + root.packetStats;
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "Octree Elements - ";
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "\tServer: " + root.serverElements +
|
||||
" Internal: " + root.serverInternal +
|
||||
" Leaves: " + root.serverLeaves;
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "\tLocal: " + root.localElements +
|
||||
" Internal: " + root.localInternal +
|
||||
" Leaves: " + root.localLeaves;
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded;
|
||||
text: "Downloads: " + root.downloads + "/" + root.downloadLimit +
|
||||
|
@ -316,6 +345,9 @@ Item {
|
|||
StatText {
|
||||
text: "GPU frame size: " + root.gpuFrameSize.x + " x " + root.gpuFrameSize.y
|
||||
}
|
||||
StatText {
|
||||
text: "LOD Target: " + root.lodTargetFramerate + " Hz Angle: " + root.lodAngle + " deg"
|
||||
}
|
||||
StatText {
|
||||
text: "Drawcalls: " + root.drawcalls
|
||||
}
|
||||
|
@ -401,35 +433,6 @@ Item {
|
|||
text: " out of view: " + root.shadowOutOfView +
|
||||
" too small: " + root.shadowTooSmall;
|
||||
}
|
||||
StatText {
|
||||
visible: !root.expanded
|
||||
text: "Octree Elements Server: " + root.serverElements +
|
||||
" Local: " + root.localElements;
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "Octree Sending Mode: " + root.sendingMode;
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "Octree Packets to Process: " + root.packetStats;
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "Octree Elements - ";
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "\tServer: " + root.serverElements +
|
||||
" Internal: " + root.serverInternal +
|
||||
" Leaves: " + root.serverLeaves;
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "\tLocal: " + root.localElements +
|
||||
" Internal: " + root.localInternal +
|
||||
" Leaves: " + root.localLeaves;
|
||||
}
|
||||
StatText {
|
||||
visible: root.expanded
|
||||
text: "LOD: " + root.lodStatus;
|
||||
|
|
|
@ -351,7 +351,18 @@ float LODManager::getHMDLODTargetFPS() const {
|
|||
}
|
||||
|
||||
float LODManager::getLODTargetFPS() const {
|
||||
auto refreshRateFPS = qApp->getRefreshRateManager().getActiveRefreshRate();
|
||||
|
||||
// Use the current refresh rate as the recommended rate target used to cap the LOD manager control value.
|
||||
// When focused, Use the Focus Inactive as the targget LOD to void abrupt changes from the lod controller.
|
||||
auto& refreshRateManager = qApp->getRefreshRateManager();
|
||||
auto refreshRateRegime = refreshRateManager.getRefreshRateRegime();
|
||||
auto refreshRateProfile = refreshRateManager.getRefreshRateProfile();
|
||||
auto refreshRateUXMode = refreshRateManager.getUXMode();
|
||||
auto refreshRateFPS = refreshRateManager.getActiveRefreshRate();
|
||||
if (refreshRateRegime == RefreshRateManager::RefreshRateRegime::FOCUS_ACTIVE) {
|
||||
refreshRateFPS = refreshRateManager.queryRefreshRateTarget(refreshRateProfile, RefreshRateManager::RefreshRateRegime::FOCUS_INACTIVE, refreshRateUXMode);
|
||||
}
|
||||
|
||||
auto lodTargetFPS = getDesktopLODTargetFPS();
|
||||
if (qApp->isHMDMode()) {
|
||||
lodTargetFPS = getHMDLODTargetFPS();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <platform/Profiler.h>
|
||||
|
||||
#include "scripting/RenderScriptingInterface.h"
|
||||
#include "LODManager.h"
|
||||
|
||||
PerformanceManager::PerformanceManager()
|
||||
{
|
||||
|
@ -68,11 +69,14 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP
|
|||
RenderScriptingInterface::getInstance()->setShadowsEnabled(true);
|
||||
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME);
|
||||
|
||||
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.5f);
|
||||
|
||||
break;
|
||||
case PerformancePreset::MID:
|
||||
RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED);
|
||||
RenderScriptingInterface::getInstance()->setShadowsEnabled(false);
|
||||
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE);
|
||||
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.5f);
|
||||
|
||||
break;
|
||||
case PerformancePreset::LOW:
|
||||
|
@ -80,6 +84,8 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP
|
|||
RenderScriptingInterface::getInstance()->setShadowsEnabled(false);
|
||||
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::ECO);
|
||||
|
||||
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.75f);
|
||||
|
||||
break;
|
||||
case PerformancePreset::UNKNOWN:
|
||||
default:
|
||||
|
|
|
@ -107,9 +107,7 @@ RefreshRateManager::RefreshRateProfile RefreshRateManager::getRefreshRateProfile
|
|||
RefreshRateManager::RefreshRateProfile profile = RefreshRateManager::RefreshRateProfile::REALTIME;
|
||||
|
||||
if (getUXMode() != RefreshRateManager::UXMode::VR) {
|
||||
profile =(RefreshRateManager::RefreshRateProfile) _refreshRateProfileSettingLock.resultWithReadLock<int>([&] {
|
||||
return _refreshRateProfileSetting.get();
|
||||
});
|
||||
return _refreshRateProfile;
|
||||
}
|
||||
|
||||
return profile;
|
||||
|
@ -138,15 +136,17 @@ void RefreshRateManager::setUXMode(RefreshRateManager::UXMode uxMode) {
|
|||
}
|
||||
}
|
||||
|
||||
int RefreshRateManager::queryRefreshRateTarget(RefreshRateProfile profile, RefreshRateRegime regime, UXMode uxMode) const {
|
||||
int targetRefreshRate = VR_TARGET_RATE;
|
||||
if (uxMode == RefreshRateManager::UXMode::DESKTOP) {
|
||||
targetRefreshRate = REFRESH_RATE_PROFILES[profile][regime];
|
||||
}
|
||||
return targetRefreshRate;
|
||||
}
|
||||
|
||||
void RefreshRateManager::updateRefreshRateController() const {
|
||||
if (_refreshRateOperator) {
|
||||
int targetRefreshRate;
|
||||
if (_uxMode == RefreshRateManager::UXMode::DESKTOP) {
|
||||
targetRefreshRate = REFRESH_RATE_PROFILES[_refreshRateProfile][_refreshRateRegime];
|
||||
} else {
|
||||
targetRefreshRate = VR_TARGET_RATE;
|
||||
}
|
||||
|
||||
int targetRefreshRate = queryRefreshRateTarget(_refreshRateProfile, _refreshRateRegime, _uxMode);
|
||||
_refreshRateOperator(targetRefreshRate);
|
||||
_activeRefreshRate = targetRefreshRate;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,9 @@ public:
|
|||
int getActiveRefreshRate() const { return _activeRefreshRate; }
|
||||
void updateRefreshRateController() const;
|
||||
|
||||
// query the refresh rate target at the specified combination
|
||||
int queryRefreshRateTarget(RefreshRateProfile profile, RefreshRateRegime regime, UXMode uxMode) const;
|
||||
|
||||
void resetInactiveTimer();
|
||||
void toggleInactive();
|
||||
|
||||
|
|
|
@ -416,6 +416,8 @@ void Stats::updateStats(bool force) {
|
|||
gpuContext->getFrameStats(gpuFrameStats);
|
||||
|
||||
STAT_UPDATE(drawcalls, gpuFrameStats._DSNumDrawcalls);
|
||||
STAT_UPDATE(lodTargetFramerate, DependencyManager::get<LODManager>()->getLODTargetFPS());
|
||||
STAT_UPDATE(lodAngle, DependencyManager::get<LODManager>()->getLODAngleDeg());
|
||||
|
||||
|
||||
// Incoming packets
|
||||
|
|
|
@ -109,6 +109,8 @@ private: \
|
|||
* @property {number} shadowRendered - <em>Read-only.</em>
|
||||
* @property {string} sendingMode - <em>Read-only.</em>
|
||||
* @property {string} packetStats - <em>Read-only.</em>
|
||||
* @property {number} lodAngle - <em>Read-only.</em>
|
||||
* @property {number} lodTargetFramerate - <em>Read-only.</em>
|
||||
* @property {string} lodStatus - <em>Read-only.</em>
|
||||
* @property {string} timingStats - <em>Read-only.</em>
|
||||
* @property {string} gameUpdateStats - <em>Read-only.</em>
|
||||
|
@ -272,6 +274,8 @@ class Stats : public QQuickItem {
|
|||
STATS_PROPERTY(int, shadowRendered, 0)
|
||||
STATS_PROPERTY(QString, sendingMode, QString())
|
||||
STATS_PROPERTY(QString, packetStats, QString())
|
||||
STATS_PROPERTY(int, lodAngle, 0)
|
||||
STATS_PROPERTY(int, lodTargetFramerate, 0)
|
||||
STATS_PROPERTY(QString, lodStatus, QString())
|
||||
STATS_PROPERTY(QString, timingStats, QString())
|
||||
STATS_PROPERTY(QString, gameUpdateStats, QString())
|
||||
|
@ -858,6 +862,20 @@ signals:
|
|||
*/
|
||||
void packetStatsChanged();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the value of the <code>lodAngle</code> property changes.
|
||||
* @function Stats.lodAngleChanged
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void lodAngleChanged();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the value of the <code>lodTargetFramerate</code> property changes.
|
||||
* @function Stats.lodTargetFramerateChanged
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void lodTargetFramerateChanged();
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the value of the <code>lodStatus</code> property changes.
|
||||
* @function Stats.lodStatusChanged
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
#include <unistd.h>
|
||||
#include <cpuid.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
using namespace platform;
|
||||
|
@ -33,18 +36,75 @@ void MACOSInstance::enumerateCpu() {
|
|||
}
|
||||
|
||||
void MACOSInstance::enumerateGpu() {
|
||||
#ifdef Q_OS_MAC
|
||||
|
||||
GPUIdent* ident = GPUIdent::getInstance();
|
||||
json gpu = {};
|
||||
|
||||
gpu[keys::gpu::vendor] = ident->getName().toUtf8().constData();
|
||||
gpu[keys::gpu::model] = ident->getName().toUtf8().constData();
|
||||
gpu[keys::gpu::videoMemory] = ident->getMemory();
|
||||
gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData();
|
||||
|
||||
_gpu.push_back(gpu);
|
||||
_display = ident->getOutput();
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void MACOSInstance::enumerateDisplays() {
|
||||
#ifdef Q_OS_MAC
|
||||
auto displayID = CGMainDisplayID();
|
||||
auto displaySize = CGDisplayScreenSize(displayID);
|
||||
|
||||
const auto MM_TO_IN = 0.0393701;
|
||||
auto displaySizeWidthInches = displaySize.width * MM_TO_IN;
|
||||
auto displaySizeHeightInches = displaySize.height * MM_TO_IN;
|
||||
auto displaySizeDiagonalInches = sqrt(displaySizeWidthInches * displaySizeWidthInches + displaySizeHeightInches * displaySizeHeightInches);
|
||||
|
||||
auto displayBounds = CGDisplayBounds(displayID);
|
||||
auto displayMaster =CGDisplayIsMain(displayID);
|
||||
|
||||
auto displayUnit =CGDisplayUnitNumber(displayID);
|
||||
auto displayModel =CGDisplayModelNumber(displayID);
|
||||
auto displayVendor = CGDisplayVendorNumber(displayID);
|
||||
auto displaySerial = CGDisplaySerialNumber(displayID);
|
||||
|
||||
auto displayMode = CGDisplayCopyDisplayMode(displayID);
|
||||
auto displayModeWidth = CGDisplayModeGetPixelWidth(displayMode);
|
||||
auto displayModeHeight = CGDisplayModeGetPixelHeight(displayMode);
|
||||
auto displayRefreshrate = CGDisplayModeGetRefreshRate(displayMode);
|
||||
|
||||
CGDisplayModeRelease(displayMode);
|
||||
|
||||
json display = {};
|
||||
|
||||
display["physicalWidth"] = displaySizeWidthInches;
|
||||
display["physicalHeight"] = displaySizeHeightInches;
|
||||
display["physicalDiagonal"] = displaySizeDiagonalInches;
|
||||
|
||||
display["ppi"] = sqrt(displayModeHeight * displayModeHeight + displayModeWidth * displayModeWidth) / displaySizeDiagonalInches;
|
||||
|
||||
display["coordLeft"] = displayBounds.origin.x;
|
||||
display["coordRight"] = displayBounds.origin.x + displayBounds.size.width;
|
||||
display["coordTop"] = displayBounds.origin.y;
|
||||
display["coordBottom"] = displayBounds.origin.y + displayBounds.size.height;
|
||||
|
||||
display["isMaster"] = displayMaster;
|
||||
|
||||
display["unit"] = displayUnit;
|
||||
display["vendor"] = displayVendor;
|
||||
display["model"] = displayModel;
|
||||
display["serial"] = displaySerial;
|
||||
|
||||
display["refreshrate"] =displayRefreshrate;
|
||||
display["modeWidth"] = displayModeWidth;
|
||||
display["modeHeight"] = displayModeHeight;
|
||||
|
||||
_display.push_back(display);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MACOSInstance::enumerateMemory() {
|
||||
json ram = {};
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace platform {
|
|||
void enumerateCpu() override;
|
||||
void enumerateMemory() override;
|
||||
void enumerateGpu() override;
|
||||
void enumerateDisplays() override;
|
||||
void enumerateComputer () override;
|
||||
};
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ bool Instance::enumeratePlatform() {
|
|||
enumerateComputer();
|
||||
enumerateCpu();
|
||||
enumerateGpu();
|
||||
enumerateDisplays();
|
||||
enumerateMemory();
|
||||
|
||||
// And profile the platform and put the tier in "computer"
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
void virtual enumerateCpu()=0;
|
||||
void virtual enumerateMemory()=0;
|
||||
void virtual enumerateGpu()=0;
|
||||
void virtual enumerateDisplays() {}
|
||||
void virtual enumerateComputer()=0;
|
||||
|
||||
virtual ~Instance();
|
||||
|
|
5
scripts/developer/utilities/render/lodWindow.js
Normal file
5
scripts/developer/utilities/render/lodWindow.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
var window = Desktop.createWindow(Script.resolvePath('./lod.qml'), {
|
||||
title: "LOD Setup",
|
||||
presentationMode: Desktop.PresentationMode.NATIVE,
|
||||
size: {x: 350, y: 500}
|
||||
});
|
Loading…
Reference in a new issue