From 813a2b1d3f821d9cf73a070232c4c4498331ec07 Mon Sep 17 00:00:00 2001 From: ykeara Date: Wed, 9 Jan 2019 20:03:41 -0600 Subject: [PATCH] removed compositor super sampling added error checking for motion smoothing --- src/res/qml/SteamVRPage.qml | 5 +- src/tabcontrollers/SteamVRTabController.cpp | 62 +++++++++------------ src/tabcontrollers/SteamVRTabController.h | 11 ++-- 3 files changed, 36 insertions(+), 42 deletions(-) diff --git a/src/res/qml/SteamVRPage.qml b/src/res/qml/SteamVRPage.qml index 6670938..5619147 100644 --- a/src/res/qml/SteamVRPage.qml +++ b/src/res/qml/SteamVRPage.qml @@ -239,7 +239,7 @@ MyStackViewPage { } } } - + /* RowLayout { spacing: 16 @@ -307,6 +307,7 @@ MyStackViewPage { } } } + */ MyToggleButton { id: steamvrAllowSupersampleFilteringToggle text: "Enable Advanced Supersample Filtering" @@ -381,6 +382,7 @@ MyStackViewPage { } steamvrSupersamplingText.text = s1 } + /* onCompositorSuperSamplingChanged: { var s2 = SteamVRTabController.compositorSuperSampling.toFixed(1) if (s2 <= steamvrCompositorSupersamplingSlider.to && Math.abs(steamvrCompositorSupersamplingSlider.value-s2) > 0.08) { @@ -388,6 +390,7 @@ MyStackViewPage { } steamvrCompositorSupersamplingText.text = s2 } + */ onAllowSupersampleFilteringChanged: { steamvrAllowSupersampleFilteringToggle.checked = SteamVRTabController.allowSupersampleFiltering } diff --git a/src/tabcontrollers/SteamVRTabController.cpp b/src/tabcontrollers/SteamVRTabController.cpp index 7061d09..93dd14a 100644 --- a/src/tabcontrollers/SteamVRTabController.cpp +++ b/src/tabcontrollers/SteamVRTabController.cpp @@ -31,7 +31,7 @@ namespace advsettings //static const char* vrsettings_steamvr_supersampleScale = "supersampleScale"; //static const char* vrsettings_steamvr_allowSupersampleFiltering = "allowSupersampleFiltering"; -static const char* vrsettings_compositor_category = "compositor"; +//static const char* vrsettings_compositor_category = "compositor"; void SteamVRTabController::initStage1() { @@ -139,7 +139,7 @@ Q_INVOKABLE QString return QString::fromStdString( steamvrProfiles[index].profileName ); } } -//TODO +//TODO DISC does it make any sense to check these settings once every ~ 1second? void SteamVRTabController::eventLoopTick() { if ( settingsUpdateCounter >= 50 ) @@ -170,38 +170,7 @@ void SteamVRTabController::eventLoopTick() << m_superSampling << " => " << ss; setSuperSampling( ss ); } - auto css = vr::VRSettings()->GetFloat( - vrsettings_compositor_category, - vr::k_pch_SteamVR_RenderTargetMultiplier_Float, - &vrSettingsError ); - if ( vrSettingsError != vr::VRSettingsError_None ) - { - if ( vrSettingsError - != vr::VRSettingsError_UnsetSettingHasNoDefault ) - { // does not appear in the default settings file as of beta - // 1477423729 - LOG( WARNING ) - << "Could not read \"compositor::" - << vr::k_pch_SteamVR_RenderTargetMultiplier_Float - << "\" setting: " - << vr::VRSettings()->GetSettingsErrorNameFromEnum( - vrSettingsError ); - } - if ( m_compositorSuperSampling != 1.0 ) - { - LOG( DEBUG ) << "OpenVR returns an error and we have a custom " - "compositor supersampling value: " - << m_compositorSuperSampling; - setCompositorSuperSampling( 1.0 ); - } - } - else if ( m_compositorSuperSampling != css ) - { - LOG( DEBUG ) - << "OpenVR reports a changed compositor supersampling value: " - << m_compositorSuperSampling << " => " << css; - setCompositorSuperSampling( css ); - } + auto sf = vr::VRSettings()->GetBool( vr::k_pch_SteamVR_Section, vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool, @@ -215,7 +184,24 @@ void SteamVRTabController::eventLoopTick() vrSettingsError ); } setAllowSupersampleFiltering( sf ); + + //Checks if Motion smoothing setting can be read + auto ms = vr::VRSettings()->GetBool( + vr::k_pch_SteamVR_Section, + vr::k_pch_SteamVR_MotionSmoothing_Bool, + &vrSettingsError); + if (vrSettingsError != vr::VRSettingsError_None) + { + LOG(WARNING) << "Could not read \"" + << vr::k_pch_SteamVR_MotionSmoothing_Bool + << "\" setting: " + << vr::VRSettings()->GetSettingsErrorNameFromEnum( + vrSettingsError); + } + setMotionSmoothing(ms); + settingsUpdateCounter = 0; + } else { @@ -248,7 +234,7 @@ void SteamVRTabController::setSuperSampling( float value, bool notify ) } } } - +/* void SteamVRTabController::setCompositorSuperSampling( float value, bool notify ) { @@ -276,16 +262,18 @@ void SteamVRTabController::setCompositorSuperSampling( float value, } } } +*/ float SteamVRTabController::superSampling() const { return m_superSampling; } - +/* float SteamVRTabController::compositorSuperSampling() const { return m_compositorSuperSampling; } +*/ bool SteamVRTabController::motionSmoothing() const { @@ -394,6 +382,7 @@ void SteamVRTabController::reset() vrSettingsError ); } + /* setCompositorSuperSampling( 1.0f ); // Is not in default.vrsettings yet vr::VRSettings()->RemoveKeyInSection( vrsettings_compositor_category, @@ -408,6 +397,7 @@ void SteamVRTabController::reset() << vr::VRSettings()->GetSettingsErrorNameFromEnum( vrSettingsError ); } + */ vr::VRSettings()->RemoveKeyInSection( vr::k_pch_SteamVR_Section, diff --git a/src/tabcontrollers/SteamVRTabController.h b/src/tabcontrollers/SteamVRTabController.h index a1f2d3b..887d2b4 100644 --- a/src/tabcontrollers/SteamVRTabController.h +++ b/src/tabcontrollers/SteamVRTabController.h @@ -28,9 +28,10 @@ class SteamVRTabController : public QObject Q_OBJECT Q_PROPERTY( float superSampling READ superSampling WRITE setSuperSampling NOTIFY superSamplingChanged ) - Q_PROPERTY( + /*Q_PROPERTY( float compositorSuperSampling READ compositorSuperSampling WRITE setCompositorSuperSampling NOTIFY compositorSuperSamplingChanged ) + */ Q_PROPERTY( bool motionSmoothing READ motionSmoothing WRITE setMotionSmoothing NOTIFY motionSmoothingChanged ) @@ -43,7 +44,7 @@ private: QQuickWindow* widget; float m_superSampling = 1.0; - float m_compositorSuperSampling = 1.0; + //float m_compositorSuperSampling = 1.0; bool m_motionSmoothing = true; bool m_allowSupersampleFiltering = true; @@ -60,7 +61,7 @@ public: void eventLoopTick(); float superSampling() const; - float compositorSuperSampling() const; + //float compositorSuperSampling() const; bool motionSmoothing() const; bool allowSupersampleFiltering() const; @@ -72,7 +73,7 @@ public: public slots: void setSuperSampling( float value, bool notify = true ); - void setCompositorSuperSampling( float value, bool notify = true ); + // void setCompositorSuperSampling( float value, bool notify = true ); void setMotionSmoothing( bool value, bool notify = true ); void setAllowSupersampleFiltering( bool value, bool notify = true ); @@ -88,7 +89,7 @@ public slots: signals: void superSamplingChanged( float value ); - void compositorSuperSamplingChanged( float value ); + //void compositorSuperSamplingChanged( float value ); void motionSmoothingChanged( bool value ); void allowSupersampleFilteringChanged( bool value );