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.
- **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.
- **Enable Advanced Supersample Filtering**: Einable/disable image filtering on supersampled renderings.
- **Allow Asynchronous Reprojection**: Enable/disable asynchronous reprojection.
- **Allow Interleaved Reprojection**: Enable/disable interleaved reprojection.
- **Enable Always-on Reprojection**: Enable/disable forced reprojection.
- **Note**: Manual Override for Super-Sampling must be checked in the SteamVR/OpenVR settings menu.
- **Enable Motion Smoothing**: Enables Motion Smoothing, and disables asynchronous 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).
<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"
}
MyToggleButton {
id: steamvrNewProfileIncludeReprojectionSettingsg
id: steamvrNewProfileIncludeMotionSmoothing
Layout.leftMargin: 32
text: "Reprojection Settings"
text: "Motion Smoothing Setting"
}
}
onClosed: {
@@ -80,13 +80,14 @@ MyStackViewPage {
steamvrMessageDialog.showMessage("Create New Profile", "ERROR: Empty profile name.")
} else if (!steamvrNewProfileIncludeSupersampling.checked
&& !steamvrNewProfileIncludeSupersampleFiltering.checked
&& !steamvrNewProfileIncludeReprojectionSettingsg.checked) {
&& !steamvrNewProfileIncludeMotionSmoothing.checked) {
steamvrMessageDialog.showMessage("Create New Profile", "ERROR: Nothing included.")
} else {
SteamVRTabController.addSteamVRProfile(steamvrNewProfileName.text,
steamvrNewProfileIncludeSupersampling.checked,
steamvrNewProfileIncludeSupersampleFiltering.checked,
steamvrNewProfileIncludeReprojectionSettingsg.checked)
steamvrNewProfileIncludeMotionSmoothing.checked
)
}
}
@@ -95,7 +96,7 @@ MyStackViewPage {
steamvrNewProfileName.text = ""
steamvrNewProfileIncludeSupersampling.checked = false
steamvrNewProfileIncludeSupersampleFiltering.checked = false
steamvrNewProfileIncludeReprojectionSettingsg.checked = false
steamvrNewProfileIncludeMotionSmoothing.checked = false
open()
}
}
@@ -141,7 +142,6 @@ MyStackViewPage {
onClicked: {
if (steamvrProfileComboBox.currentIndex > 0) {
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 {
id: steamvrAllowSupersampleFilteringToggle
text: "Enable Advanced Supersample Filtering"
@@ -317,38 +248,15 @@ MyStackViewPage {
}
MyToggleButton {
id: steamvrAllowAsyncReprojectionToggle
text: "Allow Asynchronous Reprojection"
id: steamvrMotionSmoothingToggle
text: "Enable Motion Smoothing"
onCheckedChanged: {
SteamVRTabController.setAllowAsyncReprojection(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)
SteamVRTabController.setMotionSmoothing(this.checked, false)
}
}
Item { Layout.fillHeight: true; Layout.fillWidth: true}
MyText {
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
text: "* Requires Restart"
font.pointSize: 18
}
RowLayout {
Layout.fillWidth: true
@@ -378,16 +286,8 @@ MyStackViewPage {
if (s1 <= steamvrSupersamplingSlider.to) {
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
steamvrAllowInterleavedReprojectionToggle.checked = SteamVRTabController.allowInterleavedReprojection
steamvrAllowAsyncReprojectionToggle.checked = SteamVRTabController.allowAsyncReprojection
steamvrForceReprojectionToggle.checked = SteamVRTabController.forceReprojection
steamvrMotionSmoothingToggle.checked = SteamVRTabController.motionSmoothing
reloadSteamVRProfiles()
}
@@ -400,28 +300,20 @@ MyStackViewPage {
}
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: {
steamvrAllowSupersampleFilteringToggle.checked = SteamVRTabController.allowSupersampleFiltering
}
onAllowInterleavedReprojectionChanged: {
steamvrAllowInterleavedReprojectionToggle.checked = SteamVRTabController.allowInterleavedReprojection
}
onAllowAsyncReprojectionChanged: {
steamvrAllowAsyncReprojectionToggle.checked = SteamVRTabController.allowAsyncReprojection
}
onForceReprojectionChanged: {
steamvrForceReprojectionToggle.checked = SteamVRTabController.forceReprojection
onMotionSmoothingChanged: {
steamvrMotionSmoothingToggle.checked = SteamVRTabController.motionSmoothing
}
onSteamVRProfilesUpdated: {
reloadSteamVRProfiles()
}
onSteamVRProfileAdded:{
steamvrProfileComboBox.currentIndex = SteamVRTabController.getSteamVRProfileCount()
}
}
}
+107 -276
View File
@@ -2,40 +2,12 @@
#include <QQuickWindow>
#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
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()
{
initMotionSmoothing();
eventLoopTick();
reloadSteamVRProfiles();
}
@@ -74,16 +46,12 @@ void SteamVRTabController::reloadSteamVRProfiles()
entry.supersampleFiltering
= settings->value( "supersampleFiltering", true ).toBool();
}
entry.includesReprojectionSettings
= settings->value( "includesReprojectionSettings", false ).toBool();
if ( entry.includesReprojectionSettings )
entry.includesMotionSmoothing
= settings->value( "includesMotionSmoothing", false ).toBool();
if ( entry.includesMotionSmoothing )
{
entry.asynchronousReprojection
= settings->value( "asynchronousReprojection", true ).toBool();
entry.interleavedReprojection
= settings->value( "interleavedReprojection", true ).toBool();
entry.alwaysOnReprojection
= settings->value( "alwaysOnReprojection", true ).toBool();
entry.motionSmooth
= settings->value( "motionSmooth", true ).toBool();
}
}
settings->endArray();
@@ -113,17 +81,13 @@ void SteamVRTabController::saveSteamVRProfiles()
settings->setValue( "supersampleFiltering",
p.supersampleFiltering );
}
settings->setValue( "includesReprojectionSettings",
p.includesReprojectionSettings );
if ( p.includesReprojectionSettings )
settings->setValue( "includesMotionSmoothing",
p.includesMotionSmoothing );
if ( p.includesMotionSmoothing )
{
settings->setValue( "asynchronousReprojection",
p.asynchronousReprojection );
settings->setValue( "interleavedReprojection",
p.interleavedReprojection );
settings->setValue( "alwaysOnReprojection",
p.alwaysOnReprojection );
settings->setValue( "motionSmooth", p.motionSmooth );
}
i++;
}
settings->endArray();
@@ -147,20 +111,23 @@ Q_INVOKABLE QString
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()
{
if ( settingsUpdateCounter >= 50 )
{
vr::EVRSettingsError vrSettingsError;
auto ss
= vr::VRSettings()->GetFloat( vr::k_pch_SteamVR_Section,
vrsettings_steamvr_supersampleScale,
&vrSettingsError );
// checks supersampling and re-synchs if necessary
auto ss = vr::VRSettings()->GetFloat(
vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_SupersampleScale_Float,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not read \""
<< vrsettings_steamvr_supersampleScale
<< vr::k_pch_SteamVR_SupersampleScale_Float
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
@@ -178,90 +145,38 @@ 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 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 );
// checks if Supersampling filter is on and changes if it has been
// changed elsewhere
auto sf = vr::VRSettings()->GetBool(
vr::k_pch_SteamVR_Section,
vrsettings_steamvr_allowSupersampleFiltering,
vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not read \""
<< vrsettings_steamvr_allowSupersampleFiltering
<< vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
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;
}
else
@@ -286,7 +201,7 @@ void SteamVRTabController::setSuperSampling( float value, bool notify )
<< " => " << value;
m_superSampling = value;
vr::VRSettings()->SetFloat( vr::k_pch_SteamVR_Section,
vrsettings_steamvr_supersampleScale,
vr::k_pch_SteamVR_SupersampleScale_Float,
m_superSampling );
vr::VRSettings()->Sync();
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
{
return m_superSampling;
}
float SteamVRTabController::compositorSuperSampling() const
bool SteamVRTabController::motionSmoothing() const
{
return m_compositorSuperSampling;
return m_motionSmoothing;
}
bool SteamVRTabController::allowInterleavedReprojection() const
{
return m_allowInterleavedReprojection;
}
/*
Name: setMotionSmoothing
bool SteamVRTabController::allowAsyncReprojection() const
{
return m_allowAsyncReprojection;
}
input: bool value, bool notify
output: none
void SteamVRTabController::setAllowInterleavedReprojection( bool value,
bool notify )
@value - value to be passed to m_motionSMoothing
@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::k_pch_SteamVR_AllowReprojection_Bool,
m_allowInterleavedReprojection );
vr::k_pch_SteamVR_MotionSmoothing_Bool,
m_motionSmoothing );
vr::VRSettings()->Sync();
if ( notify )
{
emit allowInterleavedReprojectionChanged(
m_allowInterleavedReprojection );
emit motionSmoothingChanged( m_motionSmoothing );
}
}
}
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;
vr::VRSettings()->SetBool(
vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_AllowAsyncReprojection_Bool,
m_allowAsyncReprojection );
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 );
}
LOG( WARNING ) << "Could not get MotionSmoothing State \""
<< vr::k_pch_SteamVR_MotionSmoothing_Bool
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
}
vr::VRSettings()->Sync();
setMotionSmoothing( temporary, true );
}
bool SteamVRTabController::allowSupersampleFiltering() const
@@ -411,9 +296,10 @@ void SteamVRTabController::setAllowSupersampleFiltering( bool value,
if ( m_allowSupersampleFiltering != value )
{
m_allowSupersampleFiltering = value;
vr::VRSettings()->SetBool( vr::k_pch_SteamVR_Section,
vrsettings_steamvr_allowSupersampleFiltering,
m_allowSupersampleFiltering );
vr::VRSettings()->SetBool(
vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool,
m_allowSupersampleFiltering );
vr::VRSettings()->Sync();
if ( notify )
{
@@ -427,27 +313,14 @@ void SteamVRTabController::reset()
{
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(
vrsettings_compositor_category,
vr::k_pch_SteamVR_RenderTargetMultiplier_Float,
vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_SupersampleScale_Float,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not remove \""
<< vrsettings_compositor_category
<< "::" << vr::k_pch_SteamVR_RenderTargetMultiplier_Float
<< vr::k_pch_SteamVR_SupersampleScale_Float
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
@@ -455,51 +328,12 @@ void SteamVRTabController::reset()
vr::VRSettings()->RemoveKeyInSection(
vr::k_pch_SteamVR_Section,
vr::k_pch_SteamVR_AllowReprojection_Bool,
vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool,
&vrSettingsError );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING ) << "Could not remove \""
<< vr::k_pch_SteamVR_AllowReprojection_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
<< vr::k_pch_SteamVR_AllowSupersampleFiltering_Bool
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
@@ -521,7 +355,7 @@ void SteamVRTabController::restartSteamVR()
void SteamVRTabController::addSteamVRProfile( QString name,
bool includeSupersampling,
bool includeSupersampleFiltering,
bool includeReprojectionSettings )
bool includeMotionSmoothing )
{
SteamVRProfile* profile = nullptr;
for ( auto& p : steamvrProfiles )
@@ -549,16 +383,15 @@ void SteamVRTabController::addSteamVRProfile( QString name,
{
profile->supersampleFiltering = m_allowSupersampleFiltering;
}
profile->includesReprojectionSettings = includeReprojectionSettings;
if ( includeReprojectionSettings )
profile->includesMotionSmoothing = includeMotionSmoothing;
if ( includeMotionSmoothing )
{
profile->asynchronousReprojection = m_allowAsyncReprojection;
profile->interleavedReprojection = m_allowInterleavedReprojection;
profile->alwaysOnReprojection = m_forceReprojection;
profile->motionSmooth = m_motionSmoothing;
}
saveSteamVRProfiles();
OverlayController::appSettings()->sync();
emit steamVRProfilesUpdated();
emit steamVRProfileAdded();
}
void SteamVRTabController::applySteamVRProfile( unsigned index )
@@ -574,11 +407,9 @@ void SteamVRTabController::applySteamVRProfile( unsigned index )
{
setAllowSupersampleFiltering( profile.supersampleFiltering );
}
if ( profile.includesReprojectionSettings )
if ( profile.includesMotionSmoothing )
{
setAllowAsyncReprojection( profile.asynchronousReprojection );
setAllowInterleavedReprojection( profile.interleavedReprojection );
setForceReprojection( profile.alwaysOnReprojection );
setMotionSmoothing( profile.motionSmooth );
}
vr::VRSettings()->Sync( true );
}
+19 -32
View File
@@ -19,11 +19,8 @@ struct SteamVRProfile
bool includesSupersampleFiltering = false;
bool supersampleFiltering = false;
bool includesReprojectionSettings = false;
bool asynchronousReprojection = true;
bool interleavedReprojection = true;
bool alwaysOnReprojection = true;
bool motionSmooth = false;
bool includesMotionSmoothing = false;
};
class SteamVRTabController : public QObject
@@ -31,18 +28,13 @@ 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 allowInterleavedReprojection READ allowInterleavedReprojection
WRITE setAllowInterleavedReprojection NOTIFY
allowInterleavedReprojectionChanged )
Q_PROPERTY(
bool allowAsyncReprojection READ allowAsyncReprojection WRITE
setAllowAsyncReprojection NOTIFY allowAsyncReprojectionChanged )
Q_PROPERTY( bool forceReprojection READ forceReprojection WRITE
setForceReprojection NOTIFY forceReprojectionChanged )
*/
Q_PROPERTY( bool motionSmoothing READ motionSmoothing WRITE
setMotionSmoothing NOTIFY motionSmoothingChanged )
Q_PROPERTY( bool allowSupersampleFiltering READ allowSupersampleFiltering
WRITE setAllowSupersampleFiltering NOTIFY
allowSupersampleFilteringChanged )
@@ -52,12 +44,12 @@ private:
QQuickWindow* widget;
float m_superSampling = 1.0;
float m_compositorSuperSampling = 1.0;
bool m_allowInterleavedReprojection = true;
bool m_allowAsyncReprojection = true;
bool m_forceReprojection = false;
// float m_compositorSuperSampling = 1.0;
bool m_motionSmoothing = true;
bool m_allowSupersampleFiltering = true;
void initMotionSmoothing();
std::vector<SteamVRProfile> steamvrProfiles;
unsigned settingsUpdateCounter = 0;
@@ -69,10 +61,8 @@ public:
void eventLoopTick();
float superSampling() const;
float compositorSuperSampling() const;
bool allowInterleavedReprojection() const;
bool allowAsyncReprojection() const;
bool forceReprojection() const;
// float compositorSuperSampling() const;
bool motionSmoothing() const;
bool allowSupersampleFiltering() const;
void reloadSteamVRProfiles();
@@ -83,16 +73,14 @@ public:
public slots:
void setSuperSampling( float value, bool notify = true );
void setCompositorSuperSampling( float value, bool notify = true );
void setAllowInterleavedReprojection( bool value, bool notify = true );
void setAllowAsyncReprojection( bool value, bool notify = true );
void setForceReprojection( bool 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 );
void addSteamVRProfile( QString name,
bool includeSupersampling,
bool includeSupersampleFiltering,
bool includeReprojectionSettings );
bool includeMotionSmoothing );
void applySteamVRProfile( unsigned index );
void deleteSteamVRProfile( unsigned index );
@@ -101,13 +89,12 @@ public slots:
signals:
void superSamplingChanged( float value );
void compositorSuperSamplingChanged( float value );
void allowInterleavedReprojectionChanged( bool value );
void allowAsyncReprojectionChanged( bool value );
void forceReprojectionChanged( bool value );
// void compositorSuperSamplingChanged( float value );
void motionSmoothingChanged( bool value );
void allowSupersampleFilteringChanged( bool value );
void steamVRProfilesUpdated();
void steamVRProfileAdded();
};
} // namespace advsettings