Merge pull request #30 from OpenVR-Advanced-Settings/SSReproFix

SteamVR tab update.
This commit is contained in:
Robin Appelman
2019-01-10 15:36:52 +01:00
committed by GitHub
5 changed files with 145 additions and 438 deletions
+2 -5
View File
@@ -126,11 +126,8 @@ If you want to try latest and greatest unreleased features, you can download lat
- **Profile**: Allows to apply/define/delete supersampling profiles that save supersampling and reprojection settings. - **Profile**: Allows to apply/define/delete supersampling profiles that save supersampling and reprojection settings.
- **Application Supersampling**: Supersampling setting for OpenVR applications/games. Application supersampling [now behaves linearly](https://steamcommunity.com/games/250820/announcements/detail/1256913672017664045) where 2.0 means twice the number of pixel. - **Application Supersampling**: Supersampling setting for OpenVR applications/games. Application supersampling [now behaves linearly](https://steamcommunity.com/games/250820/announcements/detail/1256913672017664045) where 2.0 means twice the number of pixel.
- **Compositor Render Target Multiplier**: Supersampling setting for the OpenVR compositor (Requires restart). Compositor supersampling still behaves the old way where 2.0 means four-times the number of pixel. - **Note**: Manual Override for Super-Sampling must be checked in the SteamVR/OpenVR settings menu.
- **Enable Advanced Supersample Filtering**: Einable/disable image filtering on supersampled renderings. - **Enable Motion Smoothing**: Enables Motion Smoothing, and disables asynchronous reprojection.
- **Allow Asynchronous Reprojection**: Enable/disable asynchronous reprojection.
- **Allow Interleaved Reprojection**: Enable/disable interleaved reprojection.
- **Enable Always-on Reprojection**: Enable/disable forced reprojection.
- **Restart SteamVR**: Restart SteamVR (May crash the Steam overlay when SteamVR Home is running when you restart. Therefore I advice that you close SteamVR Home before restarting). - **Restart SteamVR**: Restart SteamVR (May crash the Steam overlay when SteamVR Home is running when you restart. Therefore I advice that you close SteamVR Home before restarting).
<a name="chaperone_page"></a> <a name="chaperone_page"></a>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 57 KiB

+17 -125
View File
@@ -69,9 +69,9 @@ MyStackViewPage {
text: "Supersample Filtering" text: "Supersample Filtering"
} }
MyToggleButton { MyToggleButton {
id: steamvrNewProfileIncludeReprojectionSettingsg id: steamvrNewProfileIncludeMotionSmoothing
Layout.leftMargin: 32 Layout.leftMargin: 32
text: "Reprojection Settings" text: "Motion Smoothing Setting"
} }
} }
onClosed: { onClosed: {
@@ -80,13 +80,14 @@ MyStackViewPage {
steamvrMessageDialog.showMessage("Create New Profile", "ERROR: Empty profile name.") steamvrMessageDialog.showMessage("Create New Profile", "ERROR: Empty profile name.")
} else if (!steamvrNewProfileIncludeSupersampling.checked } else if (!steamvrNewProfileIncludeSupersampling.checked
&& !steamvrNewProfileIncludeSupersampleFiltering.checked && !steamvrNewProfileIncludeSupersampleFiltering.checked
&& !steamvrNewProfileIncludeReprojectionSettingsg.checked) { && !steamvrNewProfileIncludeMotionSmoothing.checked) {
steamvrMessageDialog.showMessage("Create New Profile", "ERROR: Nothing included.") steamvrMessageDialog.showMessage("Create New Profile", "ERROR: Nothing included.")
} else { } else {
SteamVRTabController.addSteamVRProfile(steamvrNewProfileName.text, SteamVRTabController.addSteamVRProfile(steamvrNewProfileName.text,
steamvrNewProfileIncludeSupersampling.checked, steamvrNewProfileIncludeSupersampling.checked,
steamvrNewProfileIncludeSupersampleFiltering.checked, steamvrNewProfileIncludeSupersampleFiltering.checked,
steamvrNewProfileIncludeReprojectionSettingsg.checked) steamvrNewProfileIncludeMotionSmoothing.checked
)
} }
} }
@@ -95,7 +96,7 @@ MyStackViewPage {
steamvrNewProfileName.text = "" steamvrNewProfileName.text = ""
steamvrNewProfileIncludeSupersampling.checked = false steamvrNewProfileIncludeSupersampling.checked = false
steamvrNewProfileIncludeSupersampleFiltering.checked = false steamvrNewProfileIncludeSupersampleFiltering.checked = false
steamvrNewProfileIncludeReprojectionSettingsg.checked = false steamvrNewProfileIncludeMotionSmoothing.checked = false
open() open()
} }
} }
@@ -141,7 +142,6 @@ MyStackViewPage {
onClicked: { onClicked: {
if (steamvrProfileComboBox.currentIndex > 0) { if (steamvrProfileComboBox.currentIndex > 0) {
SteamVRTabController.applySteamVRProfile(steamvrProfileComboBox.currentIndex - 1) SteamVRTabController.applySteamVRProfile(steamvrProfileComboBox.currentIndex - 1)
steamvrProfileComboBox.currentIndex = 0
} }
} }
} }
@@ -239,75 +239,6 @@ MyStackViewPage {
} }
} }
} }
RowLayout {
spacing: 16
MyText {
text: "Compositor Render Target Multiplier*:"
Layout.preferredWidth: 450
Layout.rightMargin: 12
}
MyPushButton2 {
text: "-"
Layout.preferredWidth: 40
onClicked: {
steamvrCompositorSupersamplingSlider.decrease()
}
}
MySlider {
id: steamvrCompositorSupersamplingSlider
from: 0.1
to: 2
stepSize: 0.1
value: 1.0
snapMode: Slider.SnapAlways
Layout.fillWidth: true
onPositionChanged: {
var val = this.from + ( this.position * (this.to - this.from))
steamvrCompositorSupersamplingText.text = val.toFixed(1)
}
onValueChanged: {
SteamVRTabController.setCompositorSuperSampling(this.value.toFixed(1), false)
}
}
MyPushButton2 {
text: "+"
Layout.preferredWidth: 40
onClicked: {
steamvrCompositorSupersamplingSlider.increase()
}
}
MyTextField {
id: steamvrCompositorSupersamplingText
text: "0.0"
keyBoardUID: 402
Layout.preferredWidth: 100
Layout.leftMargin: 10
horizontalAlignment: Text.AlignHCenter
function onInputEvent(input) {
var val = parseFloat(input)
if (!isNaN(val)) {
if (val < 0.1) {
val = 0.1
}
var v = val.toFixed(1)
if (v <= steamvrCompositorSupersamplingSlider.to) {
steamvrCompositorSupersamplingSlider.value = v
} else {
SteamVRTabController.setCompositorSuperSampling(v, false)
}
}
text = SteamVRTabController.compositorSuperSampling.toFixed(1)
}
}
}
MyToggleButton { MyToggleButton {
id: steamvrAllowSupersampleFilteringToggle id: steamvrAllowSupersampleFilteringToggle
text: "Enable Advanced Supersample Filtering" text: "Enable Advanced Supersample Filtering"
@@ -317,38 +248,15 @@ MyStackViewPage {
} }
MyToggleButton { MyToggleButton {
id: steamvrAllowAsyncReprojectionToggle id: steamvrMotionSmoothingToggle
text: "Allow Asynchronous Reprojection" text: "Enable Motion Smoothing"
onCheckedChanged: { onCheckedChanged: {
SteamVRTabController.setAllowAsyncReprojection(this.checked, false) SteamVRTabController.setMotionSmoothing(this.checked, false)
}
}
MyToggleButton {
id: steamvrAllowInterleavedReprojectionToggle
text: "Allow Interleaved Reprojection"
onCheckedChanged: {
SteamVRTabController.setAllowInterleavedReprojection(this.checked, false)
}
}
MyToggleButton {
id: steamvrForceReprojectionToggle
text: "Enable Always-on Reprojection"
onCheckedChanged: {
SteamVRTabController.setForceReprojection(this.checked, false)
} }
} }
Item { Layout.fillHeight: true; Layout.fillWidth: true} Item { Layout.fillHeight: true; Layout.fillWidth: true}
MyText {
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
text: "* Requires Restart"
font.pointSize: 18
}
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
@@ -378,16 +286,8 @@ MyStackViewPage {
if (s1 <= steamvrSupersamplingSlider.to) { if (s1 <= steamvrSupersamplingSlider.to) {
steamvrSupersamplingSlider.value = s1 steamvrSupersamplingSlider.value = s1
} }
steamvrSupersamplingText.text = s1
var s2 = SteamVRTabController.compositorSuperSampling.toFixed(1)
if (s2 <= steamvrCompositorSupersamplingSlider.to) {
steamvrCompositorSupersamplingSlider.value = s2
}
steamvrCompositorSupersamplingText.text = s2
steamvrAllowSupersampleFilteringToggle.checked = SteamVRTabController.allowSupersampleFiltering steamvrAllowSupersampleFilteringToggle.checked = SteamVRTabController.allowSupersampleFiltering
steamvrAllowInterleavedReprojectionToggle.checked = SteamVRTabController.allowInterleavedReprojection steamvrMotionSmoothingToggle.checked = SteamVRTabController.motionSmoothing
steamvrAllowAsyncReprojectionToggle.checked = SteamVRTabController.allowAsyncReprojection
steamvrForceReprojectionToggle.checked = SteamVRTabController.forceReprojection
reloadSteamVRProfiles() reloadSteamVRProfiles()
} }
@@ -400,28 +300,20 @@ MyStackViewPage {
} }
steamvrSupersamplingText.text = s1 steamvrSupersamplingText.text = s1
} }
onCompositorSuperSamplingChanged: {
var s2 = SteamVRTabController.compositorSuperSampling.toFixed(1)
if (s2 <= steamvrCompositorSupersamplingSlider.to && Math.abs(steamvrCompositorSupersamplingSlider.value-s2) > 0.08) {
steamvrCompositorSupersamplingSlider.value = s2
}
steamvrCompositorSupersamplingText.text = s2
}
onAllowSupersampleFilteringChanged: { onAllowSupersampleFilteringChanged: {
steamvrAllowSupersampleFilteringToggle.checked = SteamVRTabController.allowSupersampleFiltering steamvrAllowSupersampleFilteringToggle.checked = SteamVRTabController.allowSupersampleFiltering
} }
onAllowInterleavedReprojectionChanged: {
steamvrAllowInterleavedReprojectionToggle.checked = SteamVRTabController.allowInterleavedReprojection onMotionSmoothingChanged: {
} steamvrMotionSmoothingToggle.checked = SteamVRTabController.motionSmoothing
onAllowAsyncReprojectionChanged: {
steamvrAllowAsyncReprojectionToggle.checked = SteamVRTabController.allowAsyncReprojection
}
onForceReprojectionChanged: {
steamvrForceReprojectionToggle.checked = SteamVRTabController.forceReprojection
} }
onSteamVRProfilesUpdated: { onSteamVRProfilesUpdated: {
reloadSteamVRProfiles() reloadSteamVRProfiles()
} }
onSteamVRProfileAdded:{
steamvrProfileComboBox.currentIndex = SteamVRTabController.getSteamVRProfileCount()
}
} }
} }
+107 -276
View File
@@ -2,40 +2,12 @@
#include <QQuickWindow> #include <QQuickWindow>
#include "../overlaycontroller.h" #include "../overlaycontroller.h"
namespace vr
{
// this was removed from openvr_api.h in 1.0.8
static const char* const k_pch_SteamVR_RenderTargetMultiplier_Float
= "renderTargetMultiplier";
// This was removed when updating from an unknown version to OpenVR
// version 1.1.3. This should probably be removed along with any features
// connected to it. Valve probably removed it for a reason.
static const char* const k_pch_SteamVR_AllowAsyncReprojection_Bool
= "allowAsyncReprojection";
static const char* const k_pch_SteamVR_AllowReprojection_Bool
= "allowInterleavedReprojection";
static const char* const k_pch_SteamVR_ForceReprojection_Bool
= "forceReprojection";
} // namespace vr
// application namespace // application namespace
namespace advsettings namespace advsettings
{ {
// openvr's github repo hasn't been updated yet to reflect changes in beta
// 1477423729.
// static const char* vrsettings_steamvr_allowAsyncReprojection =
// "allowAsyncReprojection"; static const char*
// vrsettings_steamvr_allowInterleavedReprojection =
// "allowInterleavedReprojection";
static const char* vrsettings_steamvr_supersampleScale = "supersampleScale";
static const char* vrsettings_steamvr_allowSupersampleFiltering
= "allowSupersampleFiltering";
static const char* vrsettings_compositor_category = "compositor";
void SteamVRTabController::initStage1() void SteamVRTabController::initStage1()
{ {
initMotionSmoothing();
eventLoopTick(); eventLoopTick();
reloadSteamVRProfiles(); reloadSteamVRProfiles();
} }
@@ -74,16 +46,12 @@ void SteamVRTabController::reloadSteamVRProfiles()
entry.supersampleFiltering entry.supersampleFiltering
= settings->value( "supersampleFiltering", true ).toBool(); = settings->value( "supersampleFiltering", true ).toBool();
} }
entry.includesReprojectionSettings entry.includesMotionSmoothing
= settings->value( "includesReprojectionSettings", false ).toBool(); = settings->value( "includesMotionSmoothing", false ).toBool();
if ( entry.includesReprojectionSettings ) if ( entry.includesMotionSmoothing )
{ {
entry.asynchronousReprojection entry.motionSmooth
= settings->value( "asynchronousReprojection", true ).toBool(); = settings->value( "motionSmooth", true ).toBool();
entry.interleavedReprojection
= settings->value( "interleavedReprojection", true ).toBool();
entry.alwaysOnReprojection
= settings->value( "alwaysOnReprojection", true ).toBool();
} }
} }
settings->endArray(); settings->endArray();
@@ -113,17 +81,13 @@ void SteamVRTabController::saveSteamVRProfiles()
settings->setValue( "supersampleFiltering", settings->setValue( "supersampleFiltering",
p.supersampleFiltering ); p.supersampleFiltering );
} }
settings->setValue( "includesReprojectionSettings", settings->setValue( "includesMotionSmoothing",
p.includesReprojectionSettings ); p.includesMotionSmoothing );
if ( p.includesReprojectionSettings ) if ( p.includesMotionSmoothing )
{ {
settings->setValue( "asynchronousReprojection", settings->setValue( "motionSmooth", p.motionSmooth );
p.asynchronousReprojection );
settings->setValue( "interleavedReprojection",
p.interleavedReprojection );
settings->setValue( "alwaysOnReprojection",
p.alwaysOnReprojection );
} }
i++; i++;
} }
settings->endArray(); settings->endArray();
@@ -147,20 +111,23 @@ Q_INVOKABLE QString
return QString::fromStdString( steamvrProfiles[index].profileName ); return QString::fromStdString( steamvrProfiles[index].profileName );
} }
} }
// TODO DISC does it make any sense to check these settings once every ~
// 1second. primary purpose seems to be to re-sync settings if changed via other
// means?
void SteamVRTabController::eventLoopTick() void SteamVRTabController::eventLoopTick()
{ {
if ( settingsUpdateCounter >= 50 ) if ( settingsUpdateCounter >= 50 )
{ {
vr::EVRSettingsError vrSettingsError; vr::EVRSettingsError vrSettingsError;
auto ss // checks supersampling and re-synchs if necessary
= vr::VRSettings()->GetFloat( vr::k_pch_SteamVR_Section, auto ss = vr::VRSettings()->GetFloat(
vrsettings_steamvr_supersampleScale, vr::k_pch_SteamVR_Section,
&vrSettingsError ); vr::k_pch_SteamVR_SupersampleScale_Float,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None ) if ( vrSettingsError != vr::VRSettingsError_None )
{ {
LOG( WARNING ) << "Could not read \"" LOG( WARNING ) << "Could not read \""
<< vrsettings_steamvr_supersampleScale << vr::k_pch_SteamVR_SupersampleScale_Float
<< "\" setting: " << "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum( << vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError ); vrSettingsError );
@@ -178,90 +145,38 @@ void SteamVRTabController::eventLoopTick()
<< m_superSampling << " => " << ss; << m_superSampling << " => " << ss;
setSuperSampling( ss ); setSuperSampling( ss );
} }
auto css = vr::VRSettings()->GetFloat( // checks if Supersampling filter is on and changes if it has been
vrsettings_compositor_category, // changed elsewhere
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 air = vr::VRSettings()->GetBool(
vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_AllowReprojection_Bool,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not read \""
<< vr::k_pch_SteamVR_AllowReprojection_Bool
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
setAllowInterleavedReprojection( air );
auto aar = vr::VRSettings()->GetBool(
vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_AllowAsyncReprojection_Bool,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not read \""
<< vr::k_pch_SteamVR_AllowAsyncReprojection_Bool
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
setAllowAsyncReprojection( aar );
auto fr = vr::VRSettings()->GetBool(
vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_ForceReprojection_Bool,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not read \""
<< vr::k_pch_SteamVR_ForceReprojection_Bool
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
setForceReprojection( fr );
auto sf = vr::VRSettings()->GetBool( auto sf = vr::VRSettings()->GetBool(
vr::k_pch_SteamVR_Section, vr::k_pch_SteamVR_Section,
vrsettings_steamvr_allowSupersampleFiltering, vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool,
&vrSettingsError ); &vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None ) if ( vrSettingsError != vr::VRSettingsError_None )
{ {
LOG( WARNING ) << "Could not read \"" LOG( WARNING ) << "Could not read \""
<< vrsettings_steamvr_allowSupersampleFiltering << vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool
<< "\" setting: " << "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum( << vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError ); vrSettingsError );
} }
setAllowSupersampleFiltering( sf ); setAllowSupersampleFiltering( sf );
// Checks if Motion smoothing setting can be read and synchs adv
// settings to steamvr/openvr
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; settingsUpdateCounter = 0;
} }
else else
@@ -286,7 +201,7 @@ void SteamVRTabController::setSuperSampling( float value, bool notify )
<< " => " << value; << " => " << value;
m_superSampling = value; m_superSampling = value;
vr::VRSettings()->SetFloat( vr::k_pch_SteamVR_Section, vr::VRSettings()->SetFloat( vr::k_pch_SteamVR_Section,
vrsettings_steamvr_supersampleScale, vr::k_pch_SteamVR_SupersampleScale_Float,
m_superSampling ); m_superSampling );
vr::VRSettings()->Sync(); vr::VRSettings()->Sync();
if ( notify ) if ( notify )
@@ -296,108 +211,78 @@ void SteamVRTabController::setSuperSampling( float value, bool notify )
} }
} }
void SteamVRTabController::setCompositorSuperSampling( float value,
bool notify )
{
bool override = false;
if ( value <= 0.01f )
{
LOG( WARNING ) << "Encountered a compositor supersampling value <= "
"0.01, setting supersampling to 1.0";
value = 1.0f;
override = true;
}
if ( override || m_compositorSuperSampling != value )
{
LOG( DEBUG ) << "Compositor supersampling value changed: "
<< m_compositorSuperSampling << " => " << value;
m_compositorSuperSampling = value;
vr::VRSettings()->SetFloat(
vrsettings_compositor_category,
vr::k_pch_SteamVR_RenderTargetMultiplier_Float,
m_compositorSuperSampling );
vr::VRSettings()->Sync();
if ( notify )
{
emit compositorSuperSamplingChanged( m_compositorSuperSampling );
}
}
}
float SteamVRTabController::superSampling() const float SteamVRTabController::superSampling() const
{ {
return m_superSampling; return m_superSampling;
} }
float SteamVRTabController::compositorSuperSampling() const bool SteamVRTabController::motionSmoothing() const
{ {
return m_compositorSuperSampling; return m_motionSmoothing;
} }
bool SteamVRTabController::allowInterleavedReprojection() const /*
{ Name: setMotionSmoothing
return m_allowInterleavedReprojection;
}
bool SteamVRTabController::allowAsyncReprojection() const input: bool value, bool notify
{ output: none
return m_allowAsyncReprojection;
}
void SteamVRTabController::setAllowInterleavedReprojection( bool value, @value - value to be passed to m_motionSMoothing
bool notify ) @notify - whether QML is informed of change (default true)
Description:
sets value of m_motionSmoothing AND applies changes in Steam/OpenVr
*/
void SteamVRTabController::setMotionSmoothing( bool value, bool notify )
{ {
if ( m_allowInterleavedReprojection != value ) if ( m_motionSmoothing != value )
{ {
m_allowInterleavedReprojection = value; m_motionSmoothing = value;
vr::VRSettings()->SetBool( vr::k_pch_SteamVR_Section, vr::VRSettings()->SetBool( vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_AllowReprojection_Bool, vr::k_pch_SteamVR_MotionSmoothing_Bool,
m_allowInterleavedReprojection ); m_motionSmoothing );
vr::VRSettings()->Sync(); vr::VRSettings()->Sync();
if ( notify ) if ( notify )
{ {
emit allowInterleavedReprojectionChanged( emit motionSmoothingChanged( m_motionSmoothing );
m_allowInterleavedReprojection );
} }
} }
} }
void SteamVRTabController::setAllowAsyncReprojection( bool value, bool notify ) /*
Name: initMotionSmoothing
input: none
output: none
description: Gets the Value of Motion Smoothing from Steam/OpenVR.
Sets the member variable of motion smoothing for UI
Adds error to log if unable to find variable.
OnError:
default value of true for motion smoothing is initialized, if user has disabled
motion smoothing on their end, they will have to toggle the variable twice to
get it to re-sync.
*/
void SteamVRTabController::initMotionSmoothing()
{ {
if ( m_allowAsyncReprojection != value ) bool temporary = false;
vr::EVRSettingsError vrSettingsError;
temporary
= vr::VRSettings()->GetBool( vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_MotionSmoothing_Bool,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{ {
m_allowAsyncReprojection = value; LOG( WARNING ) << "Could not get MotionSmoothing State \""
vr::VRSettings()->SetBool( << vr::k_pch_SteamVR_MotionSmoothing_Bool
vr::k_pch_SteamVR_Section, << "\" setting: "
vr::k_pch_SteamVR_AllowAsyncReprojection_Bool, << vr::VRSettings()->GetSettingsErrorNameFromEnum(
m_allowAsyncReprojection ); vrSettingsError );
vr::VRSettings()->Sync();
if ( notify )
{
emit allowAsyncReprojectionChanged( m_allowAsyncReprojection );
}
}
}
bool SteamVRTabController::forceReprojection() const
{
return m_forceReprojection;
}
void SteamVRTabController::setForceReprojection( bool value, bool notify )
{
if ( m_forceReprojection != value )
{
m_forceReprojection = value;
vr::VRSettings()->SetBool( vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_ForceReprojection_Bool,
m_forceReprojection );
vr::VRSettings()->Sync();
if ( notify )
{
emit forceReprojectionChanged( m_forceReprojection );
}
} }
vr::VRSettings()->Sync();
setMotionSmoothing( temporary, true );
} }
bool SteamVRTabController::allowSupersampleFiltering() const bool SteamVRTabController::allowSupersampleFiltering() const
@@ -411,9 +296,10 @@ void SteamVRTabController::setAllowSupersampleFiltering( bool value,
if ( m_allowSupersampleFiltering != value ) if ( m_allowSupersampleFiltering != value )
{ {
m_allowSupersampleFiltering = value; m_allowSupersampleFiltering = value;
vr::VRSettings()->SetBool( vr::k_pch_SteamVR_Section, vr::VRSettings()->SetBool(
vrsettings_steamvr_allowSupersampleFiltering, vr::k_pch_SteamVR_Section,
m_allowSupersampleFiltering ); vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool,
m_allowSupersampleFiltering );
vr::VRSettings()->Sync(); vr::VRSettings()->Sync();
if ( notify ) if ( notify )
{ {
@@ -427,27 +313,14 @@ void SteamVRTabController::reset()
{ {
vr::EVRSettingsError vrSettingsError; vr::EVRSettingsError vrSettingsError;
vr::VRSettings()->RemoveKeyInSection( vr::k_pch_SteamVR_Section,
vrsettings_steamvr_supersampleScale,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not remove \""
<< vrsettings_steamvr_supersampleScale << "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
setCompositorSuperSampling( 1.0f ); // Is not in default.vrsettings yet
vr::VRSettings()->RemoveKeyInSection( vr::VRSettings()->RemoveKeyInSection(
vrsettings_compositor_category, vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_RenderTargetMultiplier_Float, vr::k_pch_SteamVR_SupersampleScale_Float,
&vrSettingsError ); &vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None ) if ( vrSettingsError != vr::VRSettingsError_None )
{ {
LOG( WARNING ) << "Could not remove \"" LOG( WARNING ) << "Could not remove \""
<< vrsettings_compositor_category << vr::k_pch_SteamVR_SupersampleScale_Float
<< "::" << vr::k_pch_SteamVR_RenderTargetMultiplier_Float
<< "\" setting: " << "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum( << vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError ); vrSettingsError );
@@ -455,51 +328,12 @@ void SteamVRTabController::reset()
vr::VRSettings()->RemoveKeyInSection( vr::VRSettings()->RemoveKeyInSection(
vr::k_pch_SteamVR_Section, vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_AllowReprojection_Bool, vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool,
&vrSettingsError ); &vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None ) if ( vrSettingsError != vr::VRSettingsError_None )
{ {
LOG( WARNING ) << "Could not remove \"" LOG( WARNING ) << "Could not remove \""
<< vr::k_pch_SteamVR_AllowReprojection_Bool << vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
vr::VRSettings()->RemoveKeyInSection(
vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_AllowAsyncReprojection_Bool,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not remove \""
<< vr::k_pch_SteamVR_AllowAsyncReprojection_Bool
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
vr::VRSettings()->RemoveKeyInSection(
vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_ForceReprojection_Bool,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not remove \""
<< vr::k_pch_SteamVR_ForceReprojection_Bool
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
vr::VRSettings()->RemoveKeyInSection(
vr::k_pch_SteamVR_Section,
vrsettings_steamvr_allowSupersampleFiltering,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not remove \""
<< vrsettings_steamvr_allowSupersampleFiltering
<< "\" setting: " << "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum( << vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError ); vrSettingsError );
@@ -521,7 +355,7 @@ void SteamVRTabController::restartSteamVR()
void SteamVRTabController::addSteamVRProfile( QString name, void SteamVRTabController::addSteamVRProfile( QString name,
bool includeSupersampling, bool includeSupersampling,
bool includeSupersampleFiltering, bool includeSupersampleFiltering,
bool includeReprojectionSettings ) bool includeMotionSmoothing )
{ {
SteamVRProfile* profile = nullptr; SteamVRProfile* profile = nullptr;
for ( auto& p : steamvrProfiles ) for ( auto& p : steamvrProfiles )
@@ -549,16 +383,15 @@ void SteamVRTabController::addSteamVRProfile( QString name,
{ {
profile->supersampleFiltering = m_allowSupersampleFiltering; profile->supersampleFiltering = m_allowSupersampleFiltering;
} }
profile->includesReprojectionSettings = includeReprojectionSettings; profile->includesMotionSmoothing = includeMotionSmoothing;
if ( includeReprojectionSettings ) if ( includeMotionSmoothing )
{ {
profile->asynchronousReprojection = m_allowAsyncReprojection; profile->motionSmooth = m_motionSmoothing;
profile->interleavedReprojection = m_allowInterleavedReprojection;
profile->alwaysOnReprojection = m_forceReprojection;
} }
saveSteamVRProfiles(); saveSteamVRProfiles();
OverlayController::appSettings()->sync(); OverlayController::appSettings()->sync();
emit steamVRProfilesUpdated(); emit steamVRProfilesUpdated();
emit steamVRProfileAdded();
} }
void SteamVRTabController::applySteamVRProfile( unsigned index ) void SteamVRTabController::applySteamVRProfile( unsigned index )
@@ -574,11 +407,9 @@ void SteamVRTabController::applySteamVRProfile( unsigned index )
{ {
setAllowSupersampleFiltering( profile.supersampleFiltering ); setAllowSupersampleFiltering( profile.supersampleFiltering );
} }
if ( profile.includesReprojectionSettings ) if ( profile.includesMotionSmoothing )
{ {
setAllowAsyncReprojection( profile.asynchronousReprojection ); setMotionSmoothing( profile.motionSmooth );
setAllowInterleavedReprojection( profile.interleavedReprojection );
setForceReprojection( profile.alwaysOnReprojection );
} }
vr::VRSettings()->Sync( true ); vr::VRSettings()->Sync( true );
} }
+19 -32
View File
@@ -19,11 +19,8 @@ struct SteamVRProfile
bool includesSupersampleFiltering = false; bool includesSupersampleFiltering = false;
bool supersampleFiltering = false; bool supersampleFiltering = false;
bool motionSmooth = false;
bool includesReprojectionSettings = false; bool includesMotionSmoothing = false;
bool asynchronousReprojection = true;
bool interleavedReprojection = true;
bool alwaysOnReprojection = true;
}; };
class SteamVRTabController : public QObject class SteamVRTabController : public QObject
@@ -31,18 +28,13 @@ class SteamVRTabController : public QObject
Q_OBJECT Q_OBJECT
Q_PROPERTY( float superSampling READ superSampling WRITE setSuperSampling Q_PROPERTY( float superSampling READ superSampling WRITE setSuperSampling
NOTIFY superSamplingChanged ) NOTIFY superSamplingChanged )
Q_PROPERTY( /*Q_PROPERTY(
float compositorSuperSampling READ compositorSuperSampling WRITE float compositorSuperSampling READ compositorSuperSampling WRITE
setCompositorSuperSampling NOTIFY compositorSuperSamplingChanged ) setCompositorSuperSampling NOTIFY compositorSuperSamplingChanged )
Q_PROPERTY( */
bool allowInterleavedReprojection READ allowInterleavedReprojection
WRITE setAllowInterleavedReprojection NOTIFY Q_PROPERTY( bool motionSmoothing READ motionSmoothing WRITE
allowInterleavedReprojectionChanged ) setMotionSmoothing NOTIFY motionSmoothingChanged )
Q_PROPERTY(
bool allowAsyncReprojection READ allowAsyncReprojection WRITE
setAllowAsyncReprojection NOTIFY allowAsyncReprojectionChanged )
Q_PROPERTY( bool forceReprojection READ forceReprojection WRITE
setForceReprojection NOTIFY forceReprojectionChanged )
Q_PROPERTY( bool allowSupersampleFiltering READ allowSupersampleFiltering Q_PROPERTY( bool allowSupersampleFiltering READ allowSupersampleFiltering
WRITE setAllowSupersampleFiltering NOTIFY WRITE setAllowSupersampleFiltering NOTIFY
allowSupersampleFilteringChanged ) allowSupersampleFilteringChanged )
@@ -52,12 +44,12 @@ private:
QQuickWindow* widget; QQuickWindow* widget;
float m_superSampling = 1.0; float m_superSampling = 1.0;
float m_compositorSuperSampling = 1.0; // float m_compositorSuperSampling = 1.0;
bool m_allowInterleavedReprojection = true; bool m_motionSmoothing = true;
bool m_allowAsyncReprojection = true;
bool m_forceReprojection = false;
bool m_allowSupersampleFiltering = true; bool m_allowSupersampleFiltering = true;
void initMotionSmoothing();
std::vector<SteamVRProfile> steamvrProfiles; std::vector<SteamVRProfile> steamvrProfiles;
unsigned settingsUpdateCounter = 0; unsigned settingsUpdateCounter = 0;
@@ -69,10 +61,8 @@ public:
void eventLoopTick(); void eventLoopTick();
float superSampling() const; float superSampling() const;
float compositorSuperSampling() const; // float compositorSuperSampling() const;
bool allowInterleavedReprojection() const; bool motionSmoothing() const;
bool allowAsyncReprojection() const;
bool forceReprojection() const;
bool allowSupersampleFiltering() const; bool allowSupersampleFiltering() const;
void reloadSteamVRProfiles(); void reloadSteamVRProfiles();
@@ -83,16 +73,14 @@ public:
public slots: public slots:
void setSuperSampling( float value, bool notify = true ); void setSuperSampling( float value, bool notify = true );
void setCompositorSuperSampling( float value, bool notify = true ); // void setCompositorSuperSampling( float value, bool notify = true );
void setAllowInterleavedReprojection( bool value, bool notify = true ); void setMotionSmoothing( bool value, bool notify = true );
void setAllowAsyncReprojection( bool value, bool notify = true );
void setForceReprojection( bool value, bool notify = true );
void setAllowSupersampleFiltering( bool value, bool notify = true ); void setAllowSupersampleFiltering( bool value, bool notify = true );
void addSteamVRProfile( QString name, void addSteamVRProfile( QString name,
bool includeSupersampling, bool includeSupersampling,
bool includeSupersampleFiltering, bool includeSupersampleFiltering,
bool includeReprojectionSettings ); bool includeMotionSmoothing );
void applySteamVRProfile( unsigned index ); void applySteamVRProfile( unsigned index );
void deleteSteamVRProfile( unsigned index ); void deleteSteamVRProfile( unsigned index );
@@ -101,13 +89,12 @@ public slots:
signals: signals:
void superSamplingChanged( float value ); void superSamplingChanged( float value );
void compositorSuperSamplingChanged( float value ); // void compositorSuperSamplingChanged( float value );
void allowInterleavedReprojectionChanged( bool value ); void motionSmoothingChanged( bool value );
void allowAsyncReprojectionChanged( bool value );
void forceReprojectionChanged( bool value );
void allowSupersampleFilteringChanged( bool value ); void allowSupersampleFilteringChanged( bool value );
void steamVRProfilesUpdated(); void steamVRProfilesUpdated();
void steamVRProfileAdded();
}; };
} // namespace advsettings } // namespace advsettings