Skip to content

Commit

Permalink
feat: allow disabling quad view rendering per stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Detegr committed Jul 28, 2024
1 parent cbaf948 commit dfa0281
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ struct RenderContextConfig {
float supersampling = 1.0;
std::optional<D3DMULTISAMPLE_TYPE> msaa = std::nullopt;
std::vector<int> stage_ids = {};
bool quad_view_rendering = false;
};

struct Config {
Expand Down Expand Up @@ -297,7 +298,8 @@ struct Config {
stages.push_back(static_cast<int>(*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 };
});
}

Expand Down
1 change: 1 addition & 0 deletions src/OpenVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/OpenXR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
6 changes: 6 additions & 0 deletions src/RBR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 2 additions & 0 deletions src/VR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ struct RenderContext {
IDirect3DTexture9* overlay_border;
D3DMULTISAMPLE_TYPE msaa;

bool quad_view_rendering;

void* ext;
};

Expand Down

0 comments on commit dfa0281

Please sign in to comment.