Remove unneeded getTargetFramePeriod and isVSynchronized.

This commit is contained in:
howard-stearns 2015-12-08 18:08:57 -08:00
parent 9ae22800fe
commit 1d65cbce88
9 changed files with 2 additions and 22 deletions

View file

@ -3235,8 +3235,6 @@ bool Application::isHMDMode() const {
return getActiveDisplayPlugin()->isHmd(); return getActiveDisplayPlugin()->isHmd();
} }
float Application::getTargetFrameRate() { return getActiveDisplayPlugin()->getTargetFrameRate(); } float Application::getTargetFrameRate() { return getActiveDisplayPlugin()->getTargetFrameRate(); }
float Application::getTargetFramePeriod() { return getActiveDisplayPlugin()->getTargetFramePeriod(); }
bool Application::isVSynchronized() const { return getActiveDisplayPlugin()->isVSynchronized(); }
QRect Application::getDesirableApplicationGeometry() { QRect Application::getDesirableApplicationGeometry() {
QRect applicationGeometry = getWindow()->geometry(); QRect applicationGeometry = getWindow()->geometry();

View file

@ -124,7 +124,6 @@ public:
PickRay computePickRay() const; PickRay computePickRay() const;
bool isThrottleRendering() const; bool isThrottleRendering() const;
bool isVSynchronized() const;
Camera* getCamera() { return &_myCamera; } Camera* getCamera() { return &_myCamera; }
// Represents the current view frustum of the avatar. // Represents the current view frustum of the avatar.

View file

@ -146,7 +146,7 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
PerformanceTimer perfTimer("otherAvatars"); PerformanceTimer perfTimer("otherAvatars");
float distance; float distance;
if (qApp->isVSynchronized()) { if (!qApp->isThrottleRendering()) {
_renderDistanceController.setMeasuredValueSetpoint(qApp->getTargetFrameRate()); // No problem updating in flight. _renderDistanceController.setMeasuredValueSetpoint(qApp->getTargetFrameRate()); // No problem updating in flight.
// The PID controller raises the controlled value when the measured value goes up. // The PID controller raises the controlled value when the measured value goes up.
// The measured value is frame rate. When the controlled value (1 / render cutoff distance) // The measured value is frame rate. When the controlled value (1 / render cutoff distance)
@ -155,9 +155,7 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
const float deduced = qApp->getLastUnsynchronizedFps(); const float deduced = qApp->getLastUnsynchronizedFps();
distance = 1.0f / _renderDistanceController.update(deduced, deltaTime); distance = 1.0f / _renderDistanceController.update(deduced, deltaTime);
} else { } else {
// We could keep the controller running when not vsync'd, if getLastDeducedNonVSyncFps is still meaningful. // Here we choose to just use the maximum render cutoff distance if throttled.
// But the basic 2d controller doesn't try to adjust the timer for qt load or getLastPaintWait, so running the
// Here we choose to just use the maximum render cutoff distance if: throttled, running without vsync, or 30-60 "fixed" targets.
distance = 1.0f / _renderDistanceController.getControlledValueLowLimit(); distance = 1.0f / _renderDistanceController.getControlledValueLowLimit();
} }
_renderDistanceAverage.updateAverage(distance); _renderDistanceAverage.updateAverage(distance);

View file

@ -113,10 +113,6 @@ bool Basic2DWindowOpenGLDisplayPlugin::isThrottled() const {
return shouldThrottle; return shouldThrottle;
} }
bool Basic2DWindowOpenGLDisplayPlugin::isVSynchronized() const {
return (_framerateTarget == 0) && !_isThrottled;
}
void Basic2DWindowOpenGLDisplayPlugin::updateFramerate() { void Basic2DWindowOpenGLDisplayPlugin::updateFramerate() {
QAction* checkedFramerate{ nullptr }; QAction* checkedFramerate{ nullptr };
foreach(auto action, _framerateActions) { foreach(auto action, _framerateActions) {
@ -141,11 +137,8 @@ void Basic2DWindowOpenGLDisplayPlugin::updateFramerate() {
} else if (_isThrottled) { } else if (_isThrottled) {
_framerateTarget = (float) THROTTLED_FRAMERATE; _framerateTarget = (float) THROTTLED_FRAMERATE;
} }
_inverseFrameRate = _framerateTarget ? 1.0f / (float) _framerateTarget : 1.0f / TARGET_FRAMERATE_Basic2DWindowOpenGL; // not truncated
int newInterval = getDesiredInterval(); int newInterval = getDesiredInterval();
// Note: when not isVSynchronized, we are often not likely to hit target with a newInterval timer.
// We could try subtracting an allowance for qApp->getLastPaintWait() and qt timer machinery, but that starts getting complicated.
qDebug() << newInterval; qDebug() << newInterval;
_timer.start(newInterval); _timer.start(newInterval);
} }

View file

@ -21,7 +21,6 @@ public:
virtual const QString & getName() const override; virtual const QString & getName() const override;
virtual float getTargetFrameRate() override { return _framerateTarget ? (float) _framerateTarget : TARGET_FRAMERATE_Basic2DWindowOpenGL; } virtual float getTargetFrameRate() override { return _framerateTarget ? (float) _framerateTarget : TARGET_FRAMERATE_Basic2DWindowOpenGL; }
virtual float getTargetFramePeriod() override { return _inverseFrameRate; }
virtual void activate() override; virtual void activate() override;
@ -30,7 +29,6 @@ public:
virtual void internalPresent() override; virtual void internalPresent() override;
virtual bool isThrottled() const override; virtual bool isThrottled() const override;
virtual bool isVSynchronized() const override;
protected: protected:
int getDesiredInterval() const; int getDesiredInterval() const;
@ -44,6 +42,5 @@ private:
QAction* _vsyncAction { nullptr }; QAction* _vsyncAction { nullptr };
uint32_t _framerateTarget { 0 }; uint32_t _framerateTarget { 0 };
int _fullscreenTarget{ -1 }; int _fullscreenTarget{ -1 };
float _inverseFrameRate{ 1.0f }; //seconds
bool _wantVsync { true }; bool _wantVsync { true };
}; };

View file

@ -23,7 +23,6 @@ public:
virtual bool isHmd() const override { return true; } virtual bool isHmd() const override { return true; }
virtual float getTargetFrameRate() override { return TARGET_RATE_OpenVr; } virtual float getTargetFrameRate() override { return TARGET_RATE_OpenVr; }
virtual float getTargetFramePeriod() override { return 1.0f / TARGET_RATE_OpenVr; }
virtual void activate() override; virtual void activate() override;
virtual void deactivate() override; virtual void deactivate() override;

View file

@ -58,9 +58,7 @@ public:
/// By default, all HMDs are stereo /// By default, all HMDs are stereo
virtual bool isStereo() const { return isHmd(); } virtual bool isStereo() const { return isHmd(); }
virtual bool isThrottled() const { return false; } virtual bool isThrottled() const { return false; }
virtual bool isVSynchronized() const { return true; } // false when throttled or run by non vsync timer
virtual float getTargetFrameRate() { return 0.0f; } virtual float getTargetFrameRate() { return 0.0f; }
virtual float getTargetFramePeriod() { return 0.0f; }
// Rendering support // Rendering support

View file

@ -21,7 +21,6 @@ public:
virtual void setEyeRenderPose(uint32_t frameIndex, Eye eye, const glm::mat4& pose) override final; virtual void setEyeRenderPose(uint32_t frameIndex, Eye eye, const glm::mat4& pose) override final;
virtual float getTargetFrameRate() override { return TARGET_RATE_Oculus; } virtual float getTargetFrameRate() override { return TARGET_RATE_Oculus; }
virtual float getTargetFramePeriod() override { return 1.0f / TARGET_RATE_Oculus; }
protected: protected:
virtual void internalPresent() override; virtual void internalPresent() override;

View file

@ -28,7 +28,6 @@ public:
virtual int getHmdScreen() const override; virtual int getHmdScreen() const override;
virtual float getTargetFrameRate() override { return TARGET_RATE_OculusLegacy; } virtual float getTargetFrameRate() override { return TARGET_RATE_OculusLegacy; }
virtual float getTargetFramePeriod() override { return 1.0f / TARGET_RATE_OculusLegacy; }
// Stereo specific methods // Stereo specific methods
virtual bool isHmd() const override { return true; } virtual bool isHmd() const override { return true; }