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

@@ -9,6 +9,21 @@ inline uint32_t NormalizeFrameInterpolationFps(uint32_t value) noexcept {
return value == 1 || value == 72 || value == 90 || value == 120 ? value : 0;
}
// The display refresh rate to ask the runtime for ([vr] refresh_rate): the one it lists within half
// a hertz of `requested` (runtimes report 119.9 or 120.00001 for 120), or 0 when none is close.
inline float MatchDisplayRefreshRate(const float* rates, uint32_t count, float requested) noexcept {
float best = 0.0f;
float best_distance = 0.5f;
for (uint32_t i = 0; i < count; ++i) {
const float distance = rates[i] > requested ? rates[i] - requested : requested - rates[i];
if (rates[i] > 0.0f && distance <= best_distance) {
best = rates[i];
best_distance = distance;
}
}
return best;
}
// A render-rate ceiling on the compositor's own display-time grid. Auto (1)
// renders every tick. Fixed targets cannot increase the physical refresh rate.
class FrameInterpolationPacing {