Ask the headset for a configured refresh rate, 120 Hz on the Steam Frame

[vr] refresh_rate (Hz, 0 = the headset's own) is requested through
XR_FB_display_refresh_rate each time the session starts running and
whenever the setting changes, matched against the runtime's own list
within half a hertz. Setting it back to 0 restores the rate the session
started at. A rate that is not offered, or one the runtime declines, is
logged and changes nothing.

The game renders 60 frames a second, so at 120 Hz every frame shows for
exactly two refreshes, where 72 or 90 Hz hold some frames longer than
others. The Steam Frame build defaults to 120; every other build keeps
the headset's own rate unless the player picks one.

The F10/headset panel and the Android launcher's Headset section offer
the choice; the interpolation tooltip points at it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019HBRGKTE1GnN2ah8gcZKr3
This commit is contained in:
Claude committed 2026-10-04 08:32:33 +00:00
1 parent 150062280d
commit 8b98330485
8 files changed
+215 -1

No files matched your search

@@ -12,6 +12,13 @@ static void Require(bool condition) {
}
int main() {
// [vr] refresh_rate picks the runtime's own value for the rate asked.
const float frame_rates[] = {72.0f, 90.0f, 119.98f, 144.0f};
Require(mkw::vr::MatchDisplayRefreshRate(frame_rates, 4, 120.0f) == 119.98f);
Require(mkw::vr::MatchDisplayRefreshRate(frame_rates, 4, 90.0f) == 90.0f);
Require(mkw::vr::MatchDisplayRefreshRate(frame_rates, 4, 60.0f) == 0.0f);
Require(mkw::vr::MatchDisplayRefreshRate(frame_rates, 4, 100.0f) == 0.0f);
Require(mkw::vr::MatchDisplayRefreshRate(frame_rates, 0, 120.0f) == 0.0f);
for (uint32_t target : {0u, 1u, 72u, 90u, 120u}) {
std::istringstream input("[vr]\nframe_interpolation_fps = " + std::to_string(target) + "\n");
const auto config = RuntimeConfigFile::ParseConfig(input);
+18
View File
@@ -50,6 +50,24 @@ int main() {
Require(RuntimeConfigFile::VrFoveationLevelIndex("high") == 3);
Require(RuntimeConfigFile::VrFoveationLevelIndex("ultra") == 0);
// [vr] refresh_rate: Hz asked of the runtime, 0 leaving its own. The Steam Frame
// starts at 120, twice the game's 60.
Require(Parse("[vr]\nrefresh_rate = 120\n").vrRefreshRate == 120u);
Require(Parse("[vr]\nrefresh_rate = 0\n").vrRefreshRate == 0u);
Require(Parse("[vr]\nrefresh_rate = 144\n").vrRefreshRate == 144u);
Require(!Parse("[vr]\nrefresh_rate = 30\n").vrRefreshRate.has_value());
Require(!Parse("[vr]\nrefresh_rate = 500\n").vrRefreshRate.has_value());
Require(!Parse("[vr]\nrefresh_rate = -1\n").vrRefreshRate.has_value());
Require(!Parse("[vr]\nrefresh_rate = \"120\"\n").vrRefreshRate.has_value());
Require(!Parse("[vr]\n").vrRefreshRate.has_value());
#if defined(MKW_HEADSET_STEAM_FRAME)
Require(RuntimeConfigFile::kVrRefreshRateDefault == 120u);
Require(std::string_view(MKW_VR_REFRESH_RATE_DEFAULT_TEXT) == "120");
#else
Require(RuntimeConfigFile::kVrRefreshRateDefault == 0u);
Require(std::string_view(MKW_VR_REFRESH_RATE_DEFAULT_TEXT) == "0");
#endif
// [vr] hand_tracking: the cockpit hands follow the headset's hand tracking.
Require(Parse("[vr]\nhand_tracking = true\n").vrHandTracking == true);
Require(Parse("[vr]\nhand_tracking = false\n").vrHandTracking == false);