Merge pull request #8922 from ZappoMan/report45hzTarget

when vive is on i5 report a correct target frame rate so we can see that in metaverse stats
This commit is contained in:
Brad Davis 2016-10-27 14:03:07 -07:00 committed by GitHub
commit 012e215f62
5 changed files with 21 additions and 5 deletions

View file

@ -1194,6 +1194,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
properties["dropped_frame_rate"] = displayPlugin->droppedFrameRate();
properties["sim_rate"] = getAverageSimsPerSecond();
properties["avatar_sim_rate"] = getAvatarSimrate();
properties["has_async_reprojection"] = displayPlugin->hasAsyncReprojection();
auto bandwidthRecorder = DependencyManager::get<BandwidthRecorder>();
properties["packet_rate_in"] = bandwidthRecorder->getCachedTotalAverageInputPacketsPerSecond();
@ -1237,6 +1238,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
auto glInfo = getGLContextData();
properties["gl_info"] = glInfo;
properties["gpu_free_memory"] = (int)BYTES_TO_MB(gpu::Context::getFreeGPUMemory());
properties["ideal_thread_count"] = QThread::idealThreadCount();
auto hmdHeadPose = getHMDSensorPose();
properties["hmd_head_pose_changed"] = isHMDMode() && (hmdHeadPose != lastHMDHeadPose);

View file

@ -139,6 +139,7 @@ public:
virtual bool isStereo() const { return isHmd(); }
virtual bool isThrottled() const { return false; }
virtual float getTargetFrameRate() const { return 0.0f; }
virtual bool hasAsyncReprojection() const { return false; }
/// Returns a boolean value indicating whether the display is currently visible
/// to the user. For monitor displays, false might indicate that a screensaver,

View file

@ -19,6 +19,9 @@ public:
~OculusBaseDisplayPlugin();
bool isSupported() const override;
bool hasAsyncReprojection() const override { return true; }
// Stereo specific methods
void resetSensors() override final;
bool beginFrameRender(uint32_t frameIndex) override;

View file

@ -43,7 +43,6 @@ PoseData _nextSimPoseData;
#define MIN_CORES_FOR_NORMAL_RENDER 5
bool forceInterleavedReprojection = (QThread::idealThreadCount() < MIN_CORES_FOR_NORMAL_RENDER);
static std::array<vr::Hmd_Eye, 2> VR_EYES { { vr::Eye_Left, vr::Eye_Right } };
bool _openVrDisplayActive { false };
// Flip y-axis since GL UV coords are backwards.
@ -354,6 +353,13 @@ bool OpenVrDisplayPlugin::isSupported() const {
return openVrSupported();
}
float OpenVrDisplayPlugin::getTargetFrameRate() const {
if (forceInterleavedReprojection && !_asyncReprojectionActive) {
return TARGET_RATE_OpenVr / 2.0f;
}
return TARGET_RATE_OpenVr;
}
void OpenVrDisplayPlugin::init() {
Plugin::init();
@ -398,9 +404,10 @@ bool OpenVrDisplayPlugin::internalActivate() {
memset(&timing, 0, sizeof(timing));
timing.m_nSize = sizeof(vr::Compositor_FrameTiming);
vr::VRCompositor()->GetFrameTiming(&timing);
bool asyncReprojectionActive = timing.m_nReprojectionFlags & VRCompositor_ReprojectionAsync;
_asyncReprojectionActive = timing.m_nReprojectionFlags & VRCompositor_ReprojectionAsync;
_threadedSubmit = !asyncReprojectionActive;
_threadedSubmit = !_asyncReprojectionActive;
qDebug() << "OpenVR Async Reprojection active: " << _asyncReprojectionActive;
qDebug() << "OpenVR Threaded submit enabled: " << _threadedSubmit;
_openVrDisplayActive = true;
@ -697,4 +704,4 @@ bool OpenVrDisplayPlugin::isKeyboardVisible() {
int OpenVrDisplayPlugin::getRequiredThreadCount() const {
return Parent::getRequiredThreadCount() + (_threadedSubmit ? 1 : 0);
}
}

View file

@ -40,7 +40,8 @@ public:
void init() override;
float getTargetFrameRate() const override { return TARGET_RATE_OpenVr; }
float getTargetFrameRate() const override;
bool hasAsyncReprojection() const override { return _asyncReprojectionActive; }
void customizeContext() override;
void uncustomizeContext() override;
@ -82,4 +83,6 @@ private:
std::shared_ptr<OpenVrSubmitThread> _submitThread;
std::shared_ptr<gl::OffscreenContext> _submitCanvas;
friend class OpenVrSubmitThread;
bool _asyncReprojectionActive { false };
};