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:
Shannon Romano 2019-05-15 15:58:57 -07:00 committed by GitHub
commit f360789b33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 5 deletions

View file

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

View file

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

View file

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

View file

@ -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();