mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 16:32:38 +02:00
Merge pull request #15566 from samcake/coco
BUGZ-141: Fix the LOD target value not in sync with the RefreshRate setting
This commit is contained in:
commit
f360789b33
4 changed files with 15 additions and 5 deletions
|
@ -351,10 +351,18 @@ float LODManager::getHMDLODTargetFPS() const {
|
|||
}
|
||||
|
||||
float LODManager::getLODTargetFPS() const {
|
||||
auto refreshRateFPS = qApp->getRefreshRateManager().getActiveRefreshRate();
|
||||
auto lodTargetFPS = getDesktopLODTargetFPS();
|
||||
if (qApp->isHMDMode()) {
|
||||
return getHMDLODTargetFPS();
|
||||
lodTargetFPS = getHMDLODTargetFPS();
|
||||
}
|
||||
|
||||
// if RefreshRate is slower than LOD target then it becomes the true LOD target
|
||||
if (lodTargetFPS > refreshRateFPS) {
|
||||
return refreshRateFPS;
|
||||
} else {
|
||||
return lodTargetFPS;
|
||||
}
|
||||
return getDesktopLODTargetFPS();
|
||||
}
|
||||
|
||||
void LODManager::setWorldDetailQuality(float quality) {
|
||||
|
|
|
@ -30,7 +30,7 @@ int RefreshRateController::getRefreshRateLimitPeriod() const {
|
|||
return durationNanosecondsToHz(_refreshRateLimitPeriod);
|
||||
}
|
||||
|
||||
void RefreshRateController::sleepThreadIfNeeded(QThread* thread, bool isHmd) {
|
||||
std::chrono::nanoseconds RefreshRateController::sleepThreadIfNeeded(QThread* thread, bool isHmd) {
|
||||
if (!isHmd) {
|
||||
static const std::chrono::nanoseconds EPSILON = std::chrono::milliseconds(1);
|
||||
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(_endTime - _startTime);
|
||||
|
@ -39,5 +39,7 @@ void RefreshRateController::sleepThreadIfNeeded(QThread* thread, bool isHmd) {
|
|||
if (sleepDuration.count() > 0) {
|
||||
thread->msleep(std::chrono::duration_cast<std::chrono::milliseconds>(sleepDuration).count());
|
||||
}
|
||||
return sleepDuration;
|
||||
}
|
||||
return std::chrono::nanoseconds(0);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
void clockStartTime() { _startTime = std::chrono::high_resolution_clock::now(); }
|
||||
void clockEndTime() { _endTime = std::chrono::high_resolution_clock::now(); }
|
||||
void sleepThreadIfNeeded(QThread* thread, bool isHmd);
|
||||
std::chrono::nanoseconds sleepThreadIfNeeded(QThread* thread, bool isHmd);
|
||||
private:
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> _startTime { std::chrono::high_resolution_clock::now() };
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> _endTime { std::chrono::high_resolution_clock::now() };
|
||||
|
|
|
@ -211,7 +211,7 @@ public:
|
|||
virtual void cycleDebugOutput() {}
|
||||
|
||||
void waitForPresent();
|
||||
float getAveragePresentTime() { return _movingAveragePresent.average / (float)USECS_PER_MSEC; } // in msec
|
||||
float getAveragePresentTime() { return _movingAveragePresent.average / (float)USECS_PER_MSEC; } // in msec
|
||||
|
||||
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator();
|
||||
|
||||
|
|
Loading…
Reference in a new issue