From dfa028180b75a1a60bd51d9d72b458af063c16c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Ker=C3=A4nen?= Date: Sun, 28 Jul 2024 18:37:51 +0300 Subject: [PATCH] feat: allow disabling quad view rendering per stage --- src/Config.hpp | 4 +++- src/OpenVR.cpp | 1 + src/OpenXR.cpp | 1 + src/RBR.cpp | 6 ++++++ src/VR.hpp | 2 ++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Config.hpp b/src/Config.hpp index c650afa..66784e4 100644 --- a/src/Config.hpp +++ b/src/Config.hpp @@ -78,6 +78,7 @@ struct RenderContextConfig { float supersampling = 1.0; std::optional msaa = std::nullopt; std::vector stage_ids = {}; + bool quad_view_rendering = false; }; struct Config { @@ -297,7 +298,8 @@ struct Config { stages.push_back(static_cast(*v)); }); } - cfg.gfx[k] = RenderContextConfig { ss, msaa, stages }; + bool quad_view_stage_rendering = val["quadViewRendering"].value_or(true); + cfg.gfx[k] = RenderContextConfig { ss, msaa, stages, quad_view_stage_rendering }; }); } diff --git a/src/OpenVR.cpp b/src/OpenVR.cpp index cc34580..6e2cdc4 100644 --- a/src/OpenVR.cpp +++ b/src/OpenVR.cpp @@ -86,6 +86,7 @@ void OpenVR::init(IDirect3DDevice9* dev, IDirect3DVR9** vrdev, uint32_t companio .width = { wss, wss }, .height = { hss, hss }, .msaa = gfx.second.msaa.value_or(g::cfg.gfx["default"].msaa.value()), + .quad_view_rendering = false, }; init_surfaces(dev, ctx, companionWindowWidth, companionWindowHeight); render_contexts[gfx.first] = ctx; diff --git a/src/OpenXR.cpp b/src/OpenXR.cpp index 2fe147c..18588af 100644 --- a/src/OpenXR.cpp +++ b/src/OpenXR.cpp @@ -297,6 +297,7 @@ void OpenXR::init(IDirect3DDevice9* dev, IDirect3DVR9** vrdev, uint32_t companio RenderContext ctx = { .dx_shared_handle = { 0 }, .msaa = gfx.second.msaa.value_or(g::cfg.gfx["default"].msaa.value()), + .quad_view_rendering = gfx.second.quad_view_rendering, .ext = xr_ctx }; diff --git a/src/RBR.cpp b/src/RBR.cpp index 054286f..9ba19eb 100644 --- a/src/RBR.cpp +++ b/src/RBR.cpp @@ -303,6 +303,12 @@ namespace rbr { restart_session = true; } + if (g::vr) { + bool wanted_quad_view_mode = g::vr->get_current_render_context()->quad_view_rendering; + restart_session = g::cfg.quad_view_rendering != wanted_quad_view_mode; + g::cfg.quad_view_rendering = wanted_quad_view_mode; + } + if (restart_session) { dbg("Restarting OpenXR session"); diff --git a/src/VR.hpp b/src/VR.hpp index 17e254b..92566d2 100644 --- a/src/VR.hpp +++ b/src/VR.hpp @@ -96,6 +96,8 @@ struct RenderContext { IDirect3DTexture9* overlay_border; D3DMULTISAMPLE_TYPE msaa; + bool quad_view_rendering; + void* ext; };